treewidth#

causalbase.graph.treewidth(dag)[source]#

Return an upper bound on the treewidth of dag’s moral graph.

The moral graph is triangulated by maximum cardinality search and fill-in, and the bound is the size of its largest clique minus one. It is exact whenever the moral graph is already chordal.

Parameters:
dagDAG

The graph whose moral graph is measured.

Returns:
int

The bound; 0 for a graph with no edges.