graphical_models.classes.dags.dag.DAG.has_arc

DAG.has_arc(source: Hashable, target: Hashable) bool[source]

Check if this DAG has an arc source -> target.

Parameters
  • source – Source node of arc.

  • target – Target node of arc.

Examples

>>> from graphical_models import DAG
>>> g = DAG(arcs={(0,1), (0,2)})
>>> g.has_arc(0, 1)
True
>>> g.has_arc(1, 2)
False