causaldag.classes.dag.DAG.add_arc

DAG.add_arc(i: Hashable, j: Hashable, check_acyclic=True)[source]

Add the arc i -> j to the DAG

Parameters:
  • i – source node of the arc
  • j – target node of the arc
  • check_acyclic – if True, check that the DAG remains acyclic after adding the edge.

See also

add_arcs_from()

Examples

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