class_docstr: Bipartite graph class
  
  A graph for which there are two types of nodes, such that
  edges can exist only between nodes of type 1 and type 2 (not within)
  fields of this class:
  V (int, > 0) the number of type 1 vertices
  W (int, > 0) the number of type 2 vertices
  E: (int) the number of edges
  edges: array of shape (self.E, 2) reprensenting pairwise neighbors
  weights, array of shape (self.E), +1/-1 for scending/descending links
class_docstr_tok: ["Bipartite","graph","class","A","graph","for","which","there","are","two","types","of","nodes",",","such","that","edges","can","exist","only","between","nodes","of","type","1","and","type","2","(","not","within",")","fields","of","this","class",":","V","(","int",",",">","0",")","the","number","of","type","1","vertices","W","(","int",",",">","0",")","the","number","of","type","2","vertices","E",":","(","int",")","the","number","of","edges","edges",":","array","of","shape","(","self.E",",","2",")","reprensenting","pairwise","neighbors","weights",",","array","of","shape","(","self.E",")",",","+1\/-1","for","scending\/descending","links"]
docstr: Constructor
  
  Parameters
  ----------
  V (int), the number of vertices of subset 1
  W (int), the number of vertices of subset 2
  edges=None: array of shape (self.E, 2)
              the edge array of the graph
  weights=None: array of shape (self.E)
                the associated weights array
docstr_tok: ["Constructor","Parameters","--","--","--","--","--","V","(","int",")",",","the","number","of","vertices","of","subset","1","W","(","int",")",",","the","number","of","vertices","of","subset","2","edges=None",":","array","of","shape","(","self.E",",","2",")","the","edge","array","of","the","graph","weights=None",":","array","of","shape","(","self.E",")","the","associated","weights","array"]
code: def __init__(self, V, W, edges=None, weights=None):
      """Constructor
  
      Parameters
      ----------
      V (int), the number of vertices of subset 1
      W (int), the number of vertices of subset 2
      edges=None: array of shape (self.E, 2)
                  the edge array of the graph
      weights=None: array of shape (self.E)
                    the associated weights array
      """
      V = int(V)
      W = int(W)
      if (V < 1) or (W < 1):
          raise ValueError("cannot create graph with no vertex")
      self.V = V
      self.W = W
      self.E = 0
      if (edges is None) & (weights is None):
          self.edges = np.array([], np.int_)
          self.weights = np.array([])
      else:
          if edges.shape[0] == np.size(weights):
              E = edges.shape[0]
              self.E = E
              self.edges = -np.ones((E, 2), np.int_)
              self.set_edges(edges)
              self.set_weights(weights)
          else:
              raise ValueError(
                  "Incompatible size of the edges and \
                                    weights matrices"
              )
  
file_path: nipy/nipy/algorithms/graph/bipartite_graph.py
imports: import numpy
label_desc: Use image node_id 1 to create a new BipartiteGraph object  with example: obj = BipartiteGraph(V, W, edges, weights)