causaldag.classes.dag.DAG.add_arcs_from

DAG.add_arcs_from(arcs: Iterable[Tuple], check_acyclic=False)[source]

Add arcs to the graph from the collection arcs.

Parameters:
  • arcs – collection of arcs to be added.
  • check_acyclic – if True, check that the DAG remains acyclic after adding the edge.

See also

add_arcs()

Examples

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