class_docstr: Base class for structure models, which are an extension of ``networkx.DiGraph``.
  
  A ``StructureModel`` stores nodes and edges with optional data, or attributes.
  
  Edges have one required attribute, "origin", which describes how the edge was created.
  Origin can be one of either unknown, learned, or expert.
  
  StructureModel hold directed edges, describing a cause -> effect relationship.
  Cycles are permitted within a ``StructureModel``.
  
  Nodes can be arbitrary (hashable) Python objects with optional key/value attributes.
  By convention None is not used as a node.
  
  Edges are represented as links between nodes with optional key/value attributes.
class_docstr_tok: ["Base","class","for","structure","models",",","which","are","an","extension","of","``","networkx.DiGraph","``",".","A","``","StructureModel","``","stores","nodes","and","edges","with","optional","data",",","or","attributes",".","Edges","have","one","required","attribute",",","``","origin","''",",","which","describes","how","the","edge","was","created",".","Origin","can","be","one","of","either","unknown",",","learned",",","or","expert",".","StructureModel","hold","directed","edges",",","describing","a","cause","-",">","effect","relationship",".","Cycles","are","permitted","within","a","``","StructureModel","``",".","Nodes","can","be","arbitrary","(","hashable",")","Python","objects","with","optional","key\/value","attributes",".","By","convention","None","is","not","used","as","a","node",".","Edges","are","represented","as","links","between","nodes","with","optional","key\/value","attributes","."]
docstr: Get the subgraph with the specified node.
  
  Args:
      node: the name of the node.
  
  Returns:
      The subgraph with the target node.
  
  Raises:
      NodeNotFound: if the node is not found in the graph.
docstr_tok: ["Get","the","subgraph","with","the","specified","node",".","Args",":","node",":","the","name","of","the","node",".","Returns",":","The","subgraph","with","the","target","node",".","Raises",":","NodeNotFound",":","if","the","node","is","not","found","in","the","graph","."]
code: def get_target_subgraph(self, node: Hashable) -> "StructureModel":
      """
      Get the subgraph with the specified node.
  
      Args:
          node: the name of the node.
  
      Returns:
          The subgraph with the target node.
  
      Raises:
          NodeNotFound: if the node is not found in the graph.
      """
      if node in self.nodes:
          for component in nx.weakly_connected_components(self):
              subgraph = self.subgraph(component).copy()
  
              if node in set(subgraph.nodes):
                  return subgraph
  
      raise NodeNotFound(f"Node {node} not found in the graph.")
  
file_path: causalnex/causalnex/structure/structuremodel.py
imports: from typing import Any, Hashable, List, Set, Tuple, Union
  import networkx
  import numpy
  from networkx.exception import NodeNotFound
label_desc: Use image node_id 10 for calling the StructureModel obj's underlying member method code with example usage: obj.get_target_subgraph(node) and returns: subgraph