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 largest subgraph of the Structure Model.
  
  Returns:
      The largest subgraph of the Structure Model. If no subgraph exists, None is returned.
docstr_tok: ["Get","the","largest","subgraph","of","the","Structure","Model",".","Returns",":","The","largest","subgraph","of","the","Structure","Model",".","If","no","subgraph","exists",",","None","is","returned","."]
code: def get_largest_subgraph(self) -> "StructureModel":
      """
      Get the largest subgraph of the Structure Model.
  
      Returns:
          The largest subgraph of the Structure Model. If no subgraph exists, None is returned.
      """
      largest_n_edges = 0
      largest_subgraph = None
  
      for component in nx.weakly_connected_components(self):
          subgraph = self.subgraph(component).copy()
  
          if len(subgraph.edges) > largest_n_edges:
              largest_n_edges = len(subgraph.edges)
              largest_subgraph = subgraph
  
      return largest_subgraph
  
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 9 for calling the StructureModel obj's underlying member method code with example usage: obj.get_largest_subgraph() and returns: largest_subgraph