percolation_centrality(G, attribute='percolation', states=None, weight=None)[source]

Compute the percolation centrality for nodes.

Percolation centrality of a node \(v\), at a given time, is defined as the proportion of ‘percolated paths’ that go through that node.

This measure quantifies relative impact of nodes based on their topological connectivity, as well as their percolation states.

Percolation states of nodes are used to depict network percolation scenarios (such as during infection transmission in a social network of individuals, spreading of computer viruses on computer networks, or transmission of disease over a network of towns) over time. In this measure usually the percolation state is expressed as a decimal between 0.0 and 1.0.

When all nodes are in the same percolated state this measure is equivalent to betweenness centrality.


A NetworkX graph.

attributeNone or string, optional (default=’percolation’)

Name of the node attribute to use for percolation state, used if states is None.

statesNone or dict, optional (default=None)

Specify percolation states for the nodes, nodes as keys states as values.

weightNone or string, optional (default=None)

If None, all edge weights are considered equal. Otherwise holds the name of the edge attribute used as weight. The weight of an edge is treated as the length or distance between the two sides.


Dictionary of nodes with percolation centrality as the value.


The algorithm is from Mahendra Piraveenan, Mikhail Prokopenko, and Liaquat Hossain [1] Pair dependecies are calculated and accumulated using [2]

For weighted graphs the edge weights must be greater than zero. Zero edge weights can produce an infinite number of equal length paths between pairs of nodes.



Mahendra Piraveenan, Mikhail Prokopenko, Liaquat Hossain Percolation Centrality: Quantifying Graph-Theoretic Impact of Nodes during Percolation in Networks


Ulrik Brandes: A Faster Algorithm for Betweenness Centrality. Journal of Mathematical Sociology 25(2):163-177, 2001.