absorbing_centrality.add_supernode

add_supernode(G, query=None)[source]

Adds a supernode to the graph and connects it with directed edges to the query nodes.

Parameters:
  • G (NetworkX graph) – The graph in which we want to add a supernode.
  • query (list, default is None) – The list of nodes that the supernode will be connected to. If query is None, the supernode will be connected to all the nodes in G. These new edges will be directed.
Returns:

A directed graph with the supernode, and the new edges, added. The attributes of the graph, i.e. ‘label_map’ and ‘canonical_map’, are also updated (or created if the input graph was not canonicalized) to reflect the new node.

Return type:

NetworkX graph