current_flow_closeness#
- graph_tool.centrality.current_flow_closeness(g, weight=None, vprop=None, norm=True)[git][source]#
Compute the current-flow closeness (information centrality) of the vertices.
- Parameters:
- g
Graph Graph to be used. If it is directed, it is treated as undirected.
- weight
EdgePropertyMap(optional, default:None) Edge conductances. If not supplied, every edge has unit conductance.
- vprop
VertexPropertyMap(optional, default:None) Vertex property map to store the values.
- norm
bool(optional, default:True) If
True, the values are multiplied by \(n-1\).
- g
- Returns:
- closeness
VertexPropertyMap Vertex property map with the closeness values.
- closeness
See also
closenessShortest-path closeness centrality
current_flow_betweennessRandom-walk betweenness centrality
effective_resistanceEffective resistance between vertices
kirchhoff_indexSum of the effective resistances
Notes
The current-flow closeness [brandes-centrality-2005], equivalent to the information centrality of [stephenson-rethinking-1989], is the inverse of the sum of the effective resistances (see
effective_resistance()) to the other vertices of the component,\[c_v = \frac{n - 1}{\sum_{u\ne v}R_{vu}},\]where \(n\) is the size of the component of \(v\) (the factor \(n-1\) is omitted if
norm == False), and the value is zero for isolated vertices. It is the analogue ofcloseness()with the effective resistance in place of the shortest-path distance. It requires \(O(V^2)\) memory.References
[brandes-centrality-2005]Ulrik Brandes and Daniel Fleischer, “Centrality measures based on current flow”, STACS 2005, Lecture Notes in Computer Science 3404, 533-544 (2005), DOI: 10.1007/978-3-540-31856-9_44 [sci-hub, @tor]
[stephenson-rethinking-1989]Karen Stephenson and Marvin Zelen, “Rethinking centrality: Methods and examples”, Social Networks 11, 1-37 (1989), DOI: 10.1016/0378-8733(89)90016-6 [sci-hub, @tor]
Examples
>>> g = gt.collection.data["karate"] >>> c = gt.current_flow_closeness(g) >>> print(c.a.argmax(), c.a.max()) 33 1.953035928...
The values can be visualized by drawing the network with vertex colors and sizes given by them:
>>> cmap = matplotlib.colors.LinearSegmentedColormap.from_list( ... "gray-blue", ["#d9d9d9", "#7dabd1"]) >>> gt.graph_draw(g, g.vp.pos, vertex_fill_color=c, vcmap=cmap, ... vertex_size=gt.prop_to_size(c, mi=5, ma=15), ... output="current_flow_closeness-karate.pdf") <...>
Current-flow closeness of the vertices of Zachary’s karate club network. The vertex colors, from gray to blue, and the vertex sizes increase with the value.#