graphical_models.classes.dags.dag.DAG.rename_nodes
- DAG.rename_nodes(name_map: Dict)[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
>>> from graphical_models import DAG >>> g = DAG(arcs={('a', 'b'), ('b', 'c')}) >>> g2 = g.rename_nodes({'a': 1, 'b': 2, 'c': 3}) >>> g2.arcs {(1, 2), (2, 3)}