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: Create a ``StructureModel`` with incoming_graph_data, which has come from some origin.
  
  Args:
      incoming_graph_data (Optional): input graph (optional, default: None)
                           Data to initialize graph. If None (default) an empty graph is created.
                           The data can be any format that is supported by the to_networkx_graph()
                           function, currently including edge list, dict of dicts, dict of lists,
                           NetworkX graph, NumPy matrix or 2d ndarray, SciPy sparse matrix, or PyGraphviz graph.
  
      origin (str): label for how the edges were created. Can be one of:
                  - unknown: edges exist for an unknown reason;
                  - learned: edges were created as the output of a machine-learning process;
                  - expert: edges were created by a domain expert.
  
      attr : Attributes to add to graph as key/value pairs (no attributes by default).
docstr_tok: ["Create","a","``","StructureModel","``","with","incoming_graph_data",",","which","has","come","from","some","origin",".","Args",":","incoming_graph_data","(","Optional",")",":","input","graph","(","optional",",","default",":","None",")","Data","to","initialize","graph",".","If","None","(","default",")","an","empty","graph","is","created",".","The","data","can","be","any","format","that","is","supported","by","the","to_networkx_graph","(",")","function",",","currently","including","edge","list",",","dict","of","dicts",",","dict","of","lists",",","NetworkX","graph",",","NumPy","matrix","or","2d","ndarray",",","SciPy","sparse","matrix",",","or","PyGraphviz","graph",".","origin","(","str",")",":","label","for","how","the","edges","were","created",".","Can","be","one","of",":","-","unknown",":","edges","exist","for","an","unknown","reason",";","-","learned",":","edges","were","created","as","the","output","of","a","machine-learning","process",";","-","expert",":","edges","were","created","by","a","domain","expert",".","attr",":","Attributes","to","add","to","graph","as","key\/value","pairs","(","no","attributes","by","default",")","."]
code: def __init__(
      self, incoming_graph_data=None, origin="unknown", **attr
  ):
      """
      Create a ``StructureModel`` with incoming_graph_data, which has come from some origin.
  
      Args:
          incoming_graph_data (Optional): input graph (optional, default: None)
                               Data to initialize graph. If None (default) an empty graph is created.
                               The data can be any format that is supported by the to_networkx_graph()
                               function, currently including edge list, dict of dicts, dict of lists,
                               NetworkX graph, NumPy matrix or 2d ndarray, SciPy sparse matrix, or PyGraphviz graph.
  
          origin (str): label for how the edges were created. Can be one of:
                      - unknown: edges exist for an unknown reason;
                      - learned: edges were created as the output of a machine-learning process;
                      - expert: edges were created by a domain expert.
  
          attr : Attributes to add to graph as key/value pairs (no attributes by default).
      """
      _validate_origin(origin)
      super().__init__(incoming_graph_data, **attr)
  
      for u_of_edge, v_of_edge in self.edges:
          self[u_of_edge][v_of_edge]["origin"] = origin
  
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 1 to create a new StructureModel object from inherited base classes: nx with example: obj = StructureModel(incoming_graph_data, origin)