5.2.2. pywhy_graphs.export.numpy_to_graph#

pywhy_graphs.export.numpy_to_graph(arr, arr_idx: List[Union[int, float, str, Any]], graph_type)[source]#

Convert an enumerated numpy array into causal graph.

Parameters:

arr : array-like of shape (n_nodes, n_nodes)

The array representing the causal graph with enumerations following that of EDGE_TO_VALUE_MAPPING.

arr_idx : List[Node] of length (n_nodes,)

The names of the nodes that are assigned to the graph in order of the rows/columns of arr.

graph_type : str

The type of causal graph to construct. One of (‘pag’, ‘cpdag’, ‘admg’, ‘dag’).

Returns:

graph : causal graph

The causal graph