causal_networkx.io.load_from_networkx#
- causal_networkx.io.load_from_networkx(G)[source]#
Load causal graph from networkx.
- Parameters:
G :
nx.DiGraph|nx.MultiDiGraphThe networkx graph, which contains multiple edges if there are edge attributes needed for each edge between nodes. The edge attributes encode which type of edge it is. See Notes.
- Returns:
graph : instance of causal
DAGThe causal graph.
Notes
Networkx does not support mixed edge graphs implicitly. However, they do support edge attributes. A
networkx.DiGraphencodes a normal causalcausal_networkx.DAG, while anetworkx.MultiDiGraphencodes all other causal graphs, such ascausal_networkx.CPDAG,causal_networkx.PAG,causal_networkx.ADMGby storing the different edges as edge attributes in the keyword “type”.Moreover, the graph type is stored in the “graph_type” networkx graph attribute.