code: def _subset_graph(graph, include_nodes):
      
      new_graph = nx.algorithms.transitive_closure(graph)
  
      include_nodes = set(include_nodes)
  
      for node in graph.nodes():
          if node not in include_nodes:
              new_graph.remove_node(node)
  
      for node in include_nodes:
          if node not in new_graph:
              raise RuntimeError(
                  "Couldn't find model '{}' -- does it exist or is "
                  "it disabled?".format(node)
              )
      return new_graph
docs: Create and return a new graph that is a shallow copy of graph but with
      only the nodes in include_nodes. Transitive edges across removed nodes are
      preserved as explicit new edges.