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: Extraction of a subgraph
  
  Parameters
  ----------
  valid, boolean array of shape self.V
  renumb, boolean: renumbering of the (left) edges
  
  Returns
  -------
  G : None or ``BipartiteGraph`` instance
      A new BipartiteGraph instance with only the left vertices that are
      True.  If sum(valid)==0, None is returned
docstr_tok: ["Extraction","of","a","subgraph","Parameters","--","--","--","--","--","valid",",","boolean","array","of","shape","self.V","renumb",",","boolean",":","renumbering","of","the","(","left",")","edges","Returns","--","--","--","-","G",":","None","or","``","BipartiteGraph","``","instance","A","new","BipartiteGraph","instance","with","only","the","left","vertices","that","are","True",".","If","sum","(","valid",")","==0",",","None","is","returned"]
code: def subgraph_left(self, valid, renumb=True):
      """Extraction of a subgraph
  
      Parameters
      ----------
      valid, boolean array of shape self.V
      renumb, boolean: renumbering of the (left) edges
  
      Returns
      -------
      G : None or ``BipartiteGraph`` instance
          A new BipartiteGraph instance with only the left vertices that are
          True.  If sum(valid)==0, None is returned
      """
      if np.size(valid) != self.V:
          raise ValueError("valid does not have the correct size")
  
      if np.sum(valid > 0) == 0:
          return None
  
      if self.E > 0:
          win_edges = valid[self.edges[:, 0]]
          edges = self.edges[win_edges]
          weights = self.weights[win_edges]
          if renumb:
              rindex = np.hstack((0, np.cumsum(valid > 0)))
              edges[:, 0] = rindex[edges[:, 0]]
              G = BipartiteGraph(np.sum(valid), self.W, edges, weights)
          else:
              G = BipartiteGraph(self.V, self.W, edges, weights)
  
      else:
          G = self.copy()
  
      return G
  
file_path: nipy/nipy/algorithms/graph/bipartite_graph.py
imports: import numpy
label_desc: Use image node_id 5 for calling the BipartiteGraph obj's underlying member method code with example usage: obj.subgraph_left(valid, renumb) and returns: G, None