fill_in#

causalbase.graph.fill_in(adj, order)[source]#

Triangulate a graph using the Tarjan and Yannakakis (1984) fill-in.

Visits nodes in reverse order and connects every two neighbours of the current node that come earlier in order.

Parameters:
adjnp.ndarray

Symmetric boolean adjacency matrix of an undirected graph (typically a moral graph).

orderlist[int]

A maximum cardinality ordering of adj, as returned by mcs_order().

Returns:
np.ndarray

A new symmetric boolean adjacency matrix: a chordal (triangulated) supergraph of adj. The input adj is not modified.