code: def bipartite_graph_from_coo_matrix(x):
      """
      Instantiates a weighted graph from a (sparse) coo_matrix
  
      Parameters
      ----------
      x: scipy.sparse.coo_matrix instance, the input matrix
  
      Returns
      -------
      bg: BipartiteGraph instance
      """
      i, j = x.nonzero()
      edges = np.vstack((i, j)).T
      weights = x.data
      wg = BipartiteGraph(x.shape[0], x.shape[1], edges, weights)
      return wg
  
file_path: nipy/nipy/algorithms/graph/bipartite_graph.py
imports: import numpy
label_desc: Use image node_id 2 for calling a global function with example usage: bipartite_graph_from_coo_matrix(x) and returns: wg