causal_networkx.io.load_from_networkx#
- causal_networkx.io.load_from_networkx(G)[source]#
Load causal graph from networkx.
- Parameters:
G :
nx.DiGraph
|nx.MultiDiGraph
The 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
DAG
The causal graph.
Notes
Networkx does not support mixed edge graphs implicitly. However, they do support edge attributes. A
networkx.DiGraph
encodes a normal causalcausal_networkx.DAG
, while anetworkx.MultiDiGraph
encodes all other causal graphs, such ascausal_networkx.CPDAG
,causal_networkx.PAG
,causal_networkx.ADMG
by storing the different edges as edge attributes in the keyword “type”.Moreover, the graph type is stored in the “graph_type” networkx graph attribute.