causaldag.classes.dag.DAG.add_nodes_from

DAG.add_nodes_from(nodes: Iterable[T_co])[source]

Add nodes to the graph from the collection nodes.

Parameters:nodes – collection of nodes to be added.

See also

add_node()

Examples

>>> import causaldag as cd
>>> g = cd.DAG({1, 2})
>>> g.add_nodes_from({'a', 'b'})
>>> g.add_nodes_from(range(3, 6))
>>> g.nodes
{1, 2, 'a', 'b', 3, 4, 5}