code: def node_connected_subgraph_view(g: DirectedGraph, node: Any) -> Any:
      """Returns a view of the provided graph g that contains only nodes connected to the node passed in"""
      # can't use nx.node_connected_component, because it doesn't work with DiGraphs.
      # Hence, a manual loop:
      return nx.induced_subgraph(
          g, [n for n in g.nodes if nx.has_path(g, n, node)]
      )
  
imports: import itertools
  import logging
  import re
  from abc import abstractmethod
  from typing import Any, List, Protocol
  import networkx
  from networkx.algorithms.dag import has_cycle
  from dowhy.utils.api import parse_state
  from dowhy.utils.graph_operations import daggity_to_dot
label_desc: Use image node_id 3 for calling a global function with example usage: node_connected_subgraph_view(g, node) and returns: nx