causaldag.classes.dag.DAG.to_amat¶
-
DAG.
to_amat
(node_list=None) -> (<class 'numpy.ndarray'>, <class 'list'>)[source]¶ Return an adjacency matrix for this DAG.
Parameters: node_list – List indexing the rows/columns of the matrix. See also
Returns: Return type: (amat, node_list) Example
>>> import causaldag as cd >>> g = cd.DAG(arcs={(1, 2), (1, 3), (2, 3)}) >>> g.to_amat()[0] array([[0, 1, 1], [0, 0, 1], [0, 0, 0]]) >>> g.to_amat()[1] [1, 2, 3]