6.1.2. pywhy_graphs.export.clearn_to_graph#

pywhy_graphs.export.clearn_to_graph(arr: ndarray, arr_idx: List[int | float | str | Any], graph_type: str)[source]#

Convert causal-learn array to a graph object.

Parameters:
arrnp.ndarray of shape (n_nodes, n_nodes)

The causal-learn array encoding the endpoints between nodes. Columns are the starting node and rows are the ending node.

arr_idxList[Node] of length (n_nodes)

The array index, which stores the name of the n_nodes in order of their rows/columns in arr.

graph_typestr, optional

The type of causal graph. Must be one of ‘dag’, ‘admg’, ‘cpdag’, ‘pag’.

Returns:
graphpywhy_nx.MixedEdgeGraph

The causal graph.