5.1.2. pywhy_graphs.export.clearn_to_graph#
- pywhy_graphs.export.clearn_to_graph(arr: ndarray, arr_idx: List[Union[int, float, str, Any]], graph_type: str)[source]#
Convert causal-learn array to a graph object.
- Parameters:
arr : np.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_idx : List[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_type : str, optional
The type of causal graph. Must be one of ‘dag’, ‘admg’, ‘cpdag’, ‘pag’.
- Returns:
graph : pywhy_nx.MixedEdgeGraph
The causal graph.