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

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