voterank

Contents

voterank#

graph_tool.centrality.voterank(g, k=None)[git][source]#

Return the most influential spreaders according to VoteRank.

Parameters:
gGraph

Graph to be used.

kint (optional, default: None)

Number of vertices to select. If not given, the vertices are selected until all scores vanish.

Returns:
verticesnumpy.ndarray

The selected vertices, in the order in which they are selected.

See also

prominent_group

Group of largest betweenness

group_degree

Group degree centrality

graph_tool.dynamics.SIRState

SIR epidemic model

Notes

In VoteRank [zhang-identifying-2016] every vertex has a voting ability, initially one, and votes for its neighbors, so that the score of a vertex is the sum of the abilities of the neighbors that vote for it. In each round the vertex with the largest score among those not yet selected is selected, its ability is set to zero, and the abilities of the neighbors that voted for it are reduced by \(1/\langle k\rangle\) (but not below zero), where \(\langle k\rangle\) is the average degree, so that the selected vertices tend to be far apart. The selection stops after \(k\) rounds, or when all scores vanish. Among ties, the vertex with the smallest index is selected. For directed graphs, as defined in [zhang-identifying-2016] (and as in NetworkX), every vertex votes for its in-neighbors, so that the score of a vertex is the sum of the abilities of its out-neighbors, whose abilities are reduced when it is selected, and \(\langle k\rangle\) is the average out-degree. Every edge casts one vote, and reduces the ability of the voter once when the vertex voted for is selected, so that parallel edges count with their multiplicity; an undirected self-loop (counted twice in the degree) makes a vertex vote twice for itself.

The abilities are represented exactly, as integer multiples of \(1/(n\langle k\rangle)\), so that the ties are resolved by the vertex index, rather than by the rounding errors of floating-point sums. Only the scores that change are updated in each round, and the scores are kept sorted, so that the time per round is \(O(k^2_{\max}\log V)\).

References

[zhang-identifying-2016] (1,2)

Jian-Xiong Zhang, Duan-Bing Chen, Qiang Dong, and Zhi-Dan Zhao, “Identifying a set of influential spreaders in complex networks”, Scientific Reports 6, 27823 (2016), DOI: 10.1038/srep27823 [sci-hub, @tor]

Examples

>>> g = gt.collection.data["karate"]
>>> print(gt.voterank(g, 5))
[33  0 32  2  1]

The selected vertices can be highlighted in a drawing of the network, with their order of selection as labels:

>>> vs = gt.voterank(g, 5)
>>> rank = g.new_vp("string")
>>> vcolor = g.new_vp("string", val="#cccccc")
>>> for i, v in enumerate(vs):
...     rank[v] = str(i + 1)
...     vcolor[v] = "#f28c8e"
>>> gt.graph_draw(g, g.vp.pos, vertex_text=rank, vertex_fill_color=vcolor,
...               output="voterank-karate.pdf")
<...>
../_images/voterank-karate.png

First five vertices selected by VoteRank in Zachary’s karate club network, in red, labeled by their order of selection.#