graphical_models.classes.dags.dag.DAG.vstructures

DAG.vstructures() Set[Tuple][source]

Get all v-structures in the graph, i.e., triples of the form (i, k, j) such that i->k<-j and i is not adjacent to j.

Returns

Return all triples in the graph in a v-structure (aka an immorality). A v-structure is formed when i->j<-k but there is no arc between i and k. Arcs that participate in a v-structure are identifiable from observational data.

Return type

Set[Tuple]

Example

>>> from graphical_models import DAG
>>> g = DAG(arcs={(1, 3), (2, 3)})
>>> g.vstructures()
{(1, 3, 2)}