voterank(G, number_of_nodes=None)
VoteRank computes a ranking of the nodes in a graph G based on a voting scheme. With VoteRank, all nodes vote for each of its in-neighbours and the node with the highest votes is elected iteratively. The voting ability of out-neighbors of elected nodes is decreased in subsequent turns.
Each edge is treated independently in case of multigraphs.
A NetworkX graph.
Number of ranked nodes to extract (default all nodes).
Ordered list of computed seeds. Only nodes with positive number of votes are returned.
Select a list of influential nodes in a graph using VoteRank algorithm
>>> G = nx.Graph([(0, 1), (0, 2), (0, 3), (1, 4)])
... nx.voterank(G) [0, 1]
The algorithm can be used both for undirected and directed graphs. However, the directed version is different in two ways: (i) nodes only vote for their in-neighbors and (ii) only the voting ability of elected node and its out-neighbors are updated:
>>> G = nx.DiGraph([(0, 1), (2, 1), (2, 3), (3, 4)])See :
... nx.voterank(G) [2, 3]
The following pages refer to to this document either explicitly or contain code examples using this.
networkx.algorithms.centrality.voterank_alg.voterank
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them