graphical_models.classes.dags.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

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