6.2.2. pywhy_graphs.export.numpy_to_graph#
- pywhy_graphs.export.numpy_to_graph(arr, arr_idx: List[int | float | str | Any], graph_type)[source]#
- Convert an enumerated numpy array into causal graph. - Parameters:
- arrarray-like of shape (n_nodes, n_nodes)
- The array representing the causal graph with enumerations following that of - EDGE_TO_VALUE_MAPPING.
- arr_idxList[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_typestr
- The type of causal graph to construct. One of (‘pag’, ‘cpdag’, ‘admg’, ‘dag’). 
 
- Returns:
- graphcausal graph
- The causal graph