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: Adds a causal relationship from u to v.
  
  If u or v do not currently exists in the ``StructureModel`` then they will be created.
  
  By default a relationship will be given origin="unknown", but
  may also be given "learned" or "expert" origin.
  
  Adding an edge that already exists will replace the existing edge.
  See :func:`networkx.DiGraph.add_edge`.
  
  Args:
      u_of_edge: causal node.
      v_of_edge: effect node.
      origin: label for how the edge was created. Can be one of:
                  - unknown: edge exists for an unknown reason;
                  - learned: edge was created as the output of a machine-learning process;
                  - expert: edge was created by a domain expert.
      **attr:  Attributes to add to edge as key/value pairs (no attributes by default).
docstr_tok: ["Adds","a","causal","relationship","from","u","to","v.","If","u","or","v","do","not","currently","exists","in","the","``","StructureModel","``","then","they","will","be","created",".","By","default","a","relationship","will","be","given","origin=","''","unknown","''",",","but","may","also","be","given","``","learned","''","or","``","expert","''","origin",".","Adding","an","edge","that","already","exists","will","replace","the","existing","edge",".","See",":","func",":","`","networkx.DiGraph.add_edge","`",".","Args",":","u_of_edge",":","causal","node",".","v_of_edge",":","effect","node",".","origin",":","label","for","how","the","edge","was","created",".","Can","be","one","of",":","-","unknown",":","edge","exists","for","an","unknown","reason",";","-","learned",":","edge","was","created","as","the","output","of","a","machine-learning","process",";","-","expert",":","edge","was","created","by","a","domain","expert",".","*","*","attr",":","Attributes","to","add","to","edge","as","key\/value","pairs","(","no","attributes","by","default",")","."]
code: def add_edge(
      self,
      u_of_edge: str,
      v_of_edge: str,
      origin: str = "unknown",
      **attr,
  ):
      """
      Adds a causal relationship from u to v.
  
      If u or v do not currently exists in the ``StructureModel`` then they will be created.
  
      By default a relationship will be given origin="unknown", but
      may also be given "learned" or "expert" origin.
  
      Adding an edge that already exists will replace the existing edge.
      See :func:`networkx.DiGraph.add_edge`.
  
      Args:
          u_of_edge: causal node.
          v_of_edge: effect node.
          origin: label for how the edge was created. Can be one of:
                      - unknown: edge exists for an unknown reason;
                      - learned: edge was created as the output of a machine-learning process;
                      - expert: edge was created by a domain expert.
          **attr:  Attributes to add to edge as key/value pairs (no attributes by default).
      """
      _validate_origin(origin)
  
      attr.update({"origin": origin})
      super().add_edge(u_of_edge, v_of_edge, **attr)
  
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 4 for calling the StructureModel obj's underlying member method code with example usage: obj.add_edge(u_of_edge, v_of_edge, origin) without return types