code: def test_subgraph_of_nodes(nodes, downstream, expected_edges):
      r"""
               1
             /   \
            2     3      8
           / \   / \     |
          4   5 6   7    9
      """
      graph = DiGraph({1: [2, 3], 2: [4, 5], 3: [6, 7], 8: [9]})
      subgraph = get_subgraph_of_nodes(
          graph, nodes, downstream=downstream
      )
      expected = DiGraph(expected_edges)
      assert graphs_equal(expected, subgraph)
  
imports: import pytest
  from networkx import DiGraph
  from networkx.utils import graphs_equal
  from dvc.repo.graph import get_subgraph_of_nodes
label_desc: Use image node_id 1 for calling a global function with example usage: test_subgraph_of_nodes(nodes, downstream, expected_edges) without return types