class_docstr: Basic weighted, directed graph class
  
  Member variables:
  
  * V (int): the number of vertices
  * E (int): the number of edges
  
  Methods
  
  * vertices (list, type=int, shape=(V,)): vertices id
  * edges (list, type=int, shape=(E,2)): edges as vertices id tuples
  * weights (list, type=int, shape=(E,)): weights / lengths
    of the graph's edges
class_docstr_tok: ["Basic","weighted",",","directed","graph","class","Member","variables",":","*","V","(","int",")",":","the","number","of","vertices","*","E","(","int",")",":","the","number","of","edges","Methods","*","vertices","(","list",",","type=int",",","shape=","(","V",",",")",")",":","vertices","id","*","edges","(","list",",","type=int",",","shape=","(","E,2",")",")",":","edges","as","vertices","id","tuples","*","weights","(","list",",","type=int",",","shape=","(","E",",",")",")",":","weights","\/","lengths","of","the","graph","'s","edges"]
docstr: Normalize the graph according to the index c
  Normalization means that the sum of the edges values
  that go into or out each vertex must sum to 1
  
  Parameters
  ----------
  c=0 in {0, 1, 2}, optional: index that designates the way
      according to which D is normalized
      c == 0 => for each vertex a, sum{edge[e, 0]=a} D[e]=1
      c == 1 => for each vertex b, sum{edge[e, 1]=b} D[e]=1
      c == 2 => symmetric ('l2') normalization
  
  Notes
  -----
  Note that when sum_{edge[e, .] == a } D[e] = 0, nothing is performed
docstr_tok: ["Normalize","the","graph","according","to","the","index","c","Normalization","means","that","the","sum","of","the","edges","values","that","go","into","or","out","each","vertex","must","sum","to","1","Parameters","--","--","--","--","--","c=0","in","{","0",",","1",",","2","}",",","optional",":","index","that","designates","the","way","according","to","which","D","is","normalized","c","==","0","=",">","for","each","vertex","a",",","sum","{","edge","[","e",",","0","]","=a","}","D","[","e","]","=1","c","==","1","=",">","for","each","vertex","b",",","sum","{","edge","[","e",",","1","]","=b","}","D","[","e","]","=1","c","==","2","=",">","symmetric","(","'l2","'",")","normalization","Notes","--","--","-","Note","that","when","sum_","{","edge","[","e",",",".","]","==","a","}","D","[","e","]","=","0",",","nothing","is","performed"]
code: def normalize(self, c=0):
      """Normalize the graph according to the index c
      Normalization means that the sum of the edges values
      that go into or out each vertex must sum to 1
  
      Parameters
      ----------
      c=0 in {0, 1, 2}, optional: index that designates the way
          according to which D is normalized
          c == 0 => for each vertex a, sum{edge[e, 0]=a} D[e]=1
          c == 1 => for each vertex b, sum{edge[e, 1]=b} D[e]=1
          c == 2 => symmetric ('l2') normalization
  
      Notes
      -----
      Note that when sum_{edge[e, .] == a } D[e] = 0, nothing is performed
      """
      from scipy.sparse import dia_matrix
  
      c = int(c)
      if c not in [0, 1, 2]:
          raise ValueError("c must be equal to 0, 1 or 2")
  
      if self.E == 0:
          if c < 2:
              return np.zeros(self.V)
          else:
              return np.zeros(self.V), np.zeros(self.V)
      adj = self.to_coo_matrix().tocsr()
      s1 = adj.sum(0)
      s2 = adj.sum(1)
      if c == 1:
          s = dia_matrix((1.0 / s1, 0), shape=(self.V, self.V))
          adj = adj * s
          self.weights = wgraph_from_adjacency(adj).get_weights()
          return np.asarray(s1)
      if c == 0:
          s = dia_matrix((1.0 / s2.T, 0), shape=(self.V, self.V))
          adj = s * adj
          self.weights = wgraph_from_adjacency(adj).get_weights()
          return np.asarray(s2)
      if c == 2:
          s1 = dia_matrix(
              (1.0 / np.sqrt(s1), 0), shape=(self.V, self.V)
          )
          s2 = dia_matrix(
              (1.0 / np.sqrt(adj.sum(1)), 0), shape=(self.V, self.V)
          )
          adj = (s1 * adj) * s2
          self.weights = wgraph_from_adjacency(adj).get_weights()
          return np.asarray(s1), np.asarray(s2)
  
imports: import numpy
  from scipy.sparse import coo_matrix
label_desc: Use image node_id 9 for calling the WeightedGraph obj's underlying member method code with example usage: obj.normalize(c) and returns: np, np, np,  np, np, np,  np