absorbing_centrality.canonical_relabel_nodes — absorbing-centrality documentation

# absorbing_centrality.canonical_relabel_nodes

`canonical_relabel_nodes`(G)

  Relabels the nodes in the graph, such that the new names belong in the set [1,n]. The labeling information is stored in the dictionaries G.graph[‘canonical_map’] and G.graph[‘label_map’]. These provide a way to map original to canonical node names and vice-versa, respectively.

  Parameters: | G (NetworkX graph) –
  Returns: | G_prime – The relabeled graph. It includes two attributes: G_prime.graph[‘canonical_map’] : dict Holds the mapping between the original names of the nodes and the new, canonical, names (original -> new). G_prime.graph[‘label_map’] : dict Holds the mapping between the new, canonical, names and the original names of the nodes (new -> original).
  Return type: | NetworkX graph

  Note: The relabeling of a particular node might not be consistent across two consecutive runs. Also, the relabeling happens on a copy, so the original graph will be untouched.