code: def partition_by_cut(cut, rag):
      """Compute resulting subgraphs from given bi-partition.
  
      Parameters
      ----------
      cut : array
          A array of booleans. Elements set to `True` belong to one
          set.
      rag : RAG
          The Region Adjacency Graph.
  
      Returns
      -------
      sub1, sub2 : RAG
          The two resulting subgraphs from the bi-partition.
      """
      # `cut` is derived from `D` and `W` matrices, which also follow the
      # ordering returned by `rag.nodes()` because we use
      # nx.to_scipy_sparse_matrix.
  
      # Example
      # rag.nodes() = [3, 7, 9, 13]
      # cut = [True, False, True, False]
      # nodes1 = [3, 9]
      # nodes2 = [7, 10]
  
      nodes1 = [n for i, n in enumerate(rag.nodes()) if cut[i]]
      nodes2 = [n for i, n in enumerate(rag.nodes()) if not cut[i]]
  
      sub1 = rag.subgraph(nodes1)
      sub2 = rag.subgraph(nodes2)
  
      return sub1, sub2
  
file_path: scikit-image/skimage/graph/_graph_cut.py
imports: import networkx
  import numpy
  from scipy.sparse import linalg
  from .None import _ncut, _ncut_cy
label_desc: Use image node_id 3 for calling a global function with example usage: partition_by_cut(cut, rag) and returns: sub1,  sub2