common_neighbor_centrality#
- graph_tool.structure.common_neighbor_centrality(g, vertex_pairs, alpha=0.8)[git][source]#
Return the common neighbor and centrality based parameterized algorithm (CCPA) score of pairs of vertices.
- Parameters:
- g
Graph Graph to be used. Edge directions are ignored.
- vertex_pairsiterable of pairs of
int The pairs of vertices.
- alpha
float(optional, default:0.8) Weight of the common neighbors.
- g
- Returns:
- scores
numpy.ndarray The score of every pair.
- scores
See also
vertex_similarityLocal similarity indices of pairs of vertices
community_link_predictionCommunity-based link prediction
graph_tool.centrality.closenessCloseness centrality
Notes
The score [ahmad-missing-2020] is
\[s_{uv} = \alpha|\Gamma(u)\cap\Gamma(v)| + (1-\alpha)\frac{V}{d_{uv}},\]where \(\Gamma(u)\) is the set of distinct neighbors of \(u\) other than itself, \(V\) is the number of vertices, and \(d_{uv}\) is the shortest-path distance between the vertices, all ignoring the edge directions (the second term vanishes if they are not connected). The distances are computed by a breadth-first search from every distinct first vertex of the pairs.
References
[ahmad-missing-2020]Iftikhar Ahmad, Muhammad Usman Akhtar, Salma Noor and Ambreen Shahnaz, “Missing link prediction using common neighbor and centrality based parameterized algorithm”, Scientific Reports 10, 364 (2020), DOI: 10.1038/s41598-019-57304-y [sci-hub, @tor]
Examples
>>> g = gt.collection.data["karate"] >>> print(gt.common_neighbor_centrality(g, [(0, 33), (5, 6)])) [6.6 8.4]