Editing
CausalStructures.add_edges — Function
add_edges(cg::CausalGraph, es::CausalEdge...) -> CausalGraph
add_edges(cg::CausalGraph, es::AbstractVector{CausalEdge}) -> CausalGraphReturn a new graph of the same class with edges es added. Nodes referenced by any edge are added automatically if not already present.
cg::CausalGraph: the graph to add edges to.es: the edges to add, as separate arguments or as one vector. They are applied together, so only the result must be a valid graph of the class ofcg.
A new CausalGraph of the same class as cg.
CausalStructures.remove_edges — Function
remove_edges(cg::CausalGraph, es::CausalEdge...) -> CausalGraph
remove_edges(cg::CausalGraph, es::AbstractVector{CausalEdge}) -> CausalGraphReturn a new graph of the same class with edges es removed. Nodes that become isolated are retained. Throws ArgumentError if any edge in es is not present, or if the remaining graph is not a valid graph of that class.
cg::CausalGraph: the graph to remove edges from.es: the edges to remove, as separate arguments or as one vector. They are applied together, so only the result must be a valid graph of the class ofcg.
A new CausalGraph of the same class as cg.
ArgumentError: if any edge inesis not present incg.ArgumentError: if the remaining graph violates the invariant of its class, which can happen forCPDAG,MPDAG,MAGandPAG. To remove such edges, firstreclasscgto a class without that invariant:PDAGfor a CPDAG or MPDAG,AGfor a MAG,UNKNOWNfor a PAG.
CausalStructures.add_nodes — Function
add_nodes(cg::CausalGraph, ns::Symbol...) -> CausalGraph
add_nodes(cg::CausalGraph, ns::AbstractVector{Symbol}) -> CausalGraphReturn a new graph of the same class with isolated nodes ns added. Nodes already present are ignored.
cg::CausalGraph: the graph to add nodes to.ns: the nodes to add, as separate arguments or as one vector.
A new CausalGraph of the same class as cg, or cg itself if every node in ns is already present.
CausalStructures.remove_nodes — Function
remove_nodes(cg::CausalGraph, ns::Symbol...) -> CausalGraph
remove_nodes(cg::CausalGraph, ns::AbstractVector{Symbol}) -> CausalGraphReturn a new graph of the same class with nodes ns and all their incident edges removed. Throws ArgumentError if any node in ns is not present, or if the remaining graph is not a valid graph of that class.
cg::CausalGraph: the graph to remove nodes from.ns: the nodes to remove, as separate arguments or as one vector. They are applied together, so only the result must be a valid graph of the class ofcg.
A new CausalGraph of the same class as cg.
CausalStructures.reclass — Function
reclass(cg::CausalGraph, T::Type{<:CausalGraph}) -> TReinterpret cg's nodes and edges as a graph of class T. Throws an error if the edges violate the structural constraints of T.