causaldag.classes.dag.DAG.triples

DAG.triples() → Set[Tuple][source]

Return all triples of the form (i, j, k) such that i and k are both adjacent to j.

Returns:Triples in the graph.
Return type:Set[Tuple]

Examples

>>> import causaldag as cd
>>> g = cd.DAG(arcs={(1, 3), (2, 3), (1, 2)})
>>> g.triples()
{frozenset({1, 3, 2})}