This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This is a function to merge several nodes into one in a Networkx graph | |
| def merge_nodes(G,nodes, new_node, attr_dict=None, **attr): | |
| """ | |
| Merges the selected `nodes` of the graph G into one `new_node`, | |
| meaning that all the edges that pointed to or from one of these | |
| `nodes` will point to or from the `new_node`. | |
| attr_dict and **attr are defined as in `G.add_node`. | |
| """ | |