causaldag.classes.dag.DAG.rename_nodes¶
-
DAG.
rename_nodes
(name_map: Dict[KT, VT])[source]¶ Rename the nodes in this graph according to
name_map
.Parameters: name_map – A dictionary from the current name of each node to the desired name of each node. Examples
>>> import causaldag as cd >>> g = cd.DAG(arcs={('a', 'b'), ('b', 'c')}) >>> g2 = g.rename_nodes({'a': 1, 'b': 2, 'c': 3}) >>> g2.arcs {(1, 2), (2, 3)}