code: def induced_graph(node_set, adjacency_matrix, node2idx):
      """
      To obtain the induced graph corresponding to a subset of nodes.
  
      :param node_set: Set of nodes whos ancestors must be obtained.
      :param adjacency_matrix: Graph adjacency matrix.
      :param node2idx: A dictionary mapping node names to their row or column index in the adjacency matrix.
      :returns: Numpy array representing the adjacency matrix of the induced graph.
      """
      node_idx_list = [node2idx[node] for node in node_set]
      node_idx_list.sort()
      adjacency_matrix_induced = adjacency_matrix.copy()
      adjacency_matrix_induced = adjacency_matrix_induced[node_idx_list]
      adjacency_matrix_induced = adjacency_matrix_induced[
          :, node_idx_list
      ]
      return adjacency_matrix_induced
  
imports: import re
  from queue import LifoQueue
  import networkx
  import numpy
  from networkx.algorithms.dag import is_directed_acyclic_graph
  from networkx.algorithms.shortest_paths.generic import shortest_path
  from dowhy.utils.ordered_set import OrderedSet
label_desc: Use image node_id 5 for calling a global function with example usage: induced_graph(node_set, adjacency_matrix, node2idx) and returns: adjacency_matrix_induced