code: def nx_call(M, verts, directed=True):
      if directed:
          G = nx.from_pandas_edgelist(
              M, source="0", target="1", create_using=nx.DiGraph()
          )
      else:
          G = nx.from_pandas_edgelist(
              M, source="0", target="1", create_using=nx.Graph()
          )
      return nx.subgraph(G, verts)
  
file_path: cugraph/python/cugraph/cugraph/tests/community/test_subgraph_extraction.py
imports: import gc
  import numpy
  import pytest
  import networkx
  import cudf
  import cugraph
  from cugraph.testing import utils, DEFAULT_DATASETS
  from cugraph.datasets import karate
label_desc: Use image node_id 4 for calling a global function with example usage: nx_call(M, verts, directed) and returns: nx