causaldag.classes.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

>>> import causaldag as cd
>>> g = cd.DAG(arcs={(0,1), (0,2)})
>>> g.has_arc(0, 1)
True
>>> g.has_arc(1, 2)
False