AI Glossary / Graphs and symbolic AI / Intermediate
Harmonic Centrality
Definition
Harmonic centrality measures a node's accessibility by adding the reciprocals of shortest-path distances between it and other nodes. Nearby reachable nodes contribute more than distant ones, and unreachable nodes contribute zero. The measure works naturally with disconnected networks, provided the distance and direction conventions are stated clearly.
What it means
A direct neighbor at distance 1 contributes 1, a node at distance 2 contributes one-half, and a node at distance 3 contributes one-third. A node receives a larger score when many other nodes are reachable at short distances under the chosen convention.
For directed graphs, incoming and outgoing accessibility differ. The linked NetworkX function sums distances from other nodes to the node being scored. This describes how readily the target can be reached, rather than how readily it can reach others. Reversing the graph changes that interpretation. The raw score also depends on the network and source population being considered.
How it works
Find shortest-path distances from the relevant sources to each target node. Exclude the target's distance to itself, take 1 divided by each positive finite distance, and sum the results. Treat a missing path as infinite distance, contributing zero through the reciprocal convention.
In an unweighted graph, distance is the number of edges. In a weighted graph, the selected edge attribute must mean distance or cost, with valid positive path distances for this interpretation. A large connection-strength weight should not automatically be treated as a long distance. Some presentations normalize scores; record whether values are raw sums or normalized before comparing results.
Three practical examples
- A network-analysis lesson compares central nodes in a path while keeping an isolated node in the dataset.
- A directed information-flow study distinguishes nodes that many others can reach from nodes that can reach many others.
- A transport-network prototype compares accessibility using hop counts and then positive travel distances, explaining the change in meaning.
Think of it this way
Think of awarding a point for a place one step away, half a point for a place two steps away, and progressively less for more distant places. Unreachable places add nothing. The analogy is limited because the measure uses the graph's modeled paths and weights; it does not independently know travel capacity, demand, popularity, or real-world importance.
Worked example
Build an undirected path A-B-C-D and add an isolated node E. For B, the distances to A, C, and D are 1, 1, and 2; E is unreachable. B's raw harmonic centrality is 1 + 1 + 1/2 + 0 = 2.5. C has the same score by symmetry.
For A, distances to B, C, and D are 1, 2, and 3. Its score is 1 + 1/2 + 1/3 = 11/6, approximately 1.833. D has that same score, and E has score 0. The isolated node does not make the raw calculation undefined.
Now use a separate directed chain A to B to C. Under the incoming-distance convention, A has score 0, B has score 1, and C has score 1 + 1/2 = 1.5. Under an outgoing-distance convention, A instead has 1.5 and C has 0. The reversal is not a disagreement in arithmetic; it answers a different accessibility question. Any reported ranking should identify which direction it measures.
Illustrative case study
In a fictional analysis, Lake Network Lab ranks nodes in a directed message-routing model. Its report initially describes the highest incoming harmonic score as the best broadcaster, although the calculation measures how easily other nodes can reach that node.
The reviewer relabels the first analysis and computes the outgoing version for the broadcasting question. The team presents both alongside their definitions. The invented case shows how an apparently plausible centrality ranking can be misinterpreted when edge direction and business meaning are not aligned.
Common misconceptions and mistakes
Harmonic centrality is not the arithmetic mean of distances, nor is it simply the reciprocal of their sum. It adds reciprocal distances individually, which is why it handles unreachable nodes differently from a naive closeness calculation.
A high score does not prove authority, influence, traffic capacity, or causal importance. Results also change when edges, weights, source sets, or normalization choices change. Zero-length paths between distinct nodes make reciprocal distance problematic; negative-distance interpretations are unsuitable for the ordinary accessibility measure. Resolve those modeling issues rather than treating every numeric edge attribute as an acceptable distance.
Business use
The measure offers an interpretable accessibility summary for networks that may contain disconnected components. It can help explore routing structures, dependency networks, or communication models when shortest paths are meaningful for the question.
Document the network boundary, edge direction, weighting, and source set. Compare like-for-like graphs or explain changes in scale and normalization. Pair the score with other evidence when making an operational decision: accessibility alone does not establish whether a node has enough capacity, whether the modeled routes are used, or whether changing the node would improve outcomes.
People also ask
What happens to an unreachable node's contribution?
It contributes zero, corresponding to the reciprocal of an infinite distance.
Is the measure the same on directed and undirected graphs?
The formula is related, but directed graphs require a clear incoming or outgoing convention because reachability can be asymmetric.
Why can two implementations give different values?
They may use different normalization, weights, source subsets, or direction conventions. Compare definitions before assuming one calculation is wrong.
Check your understanding
Why is B's raw score 2.5 in the five-node path-plus-isolate example?
Answer: A and C each contribute 1, D contributes 1/2, E contributes zero, and B itself is excluded. The sum is 2.5.
Related terms
- Shortest Paths
- Directed graph
- centrality
- shortest path
- closeness centrality
- reachability
- distance weight
- disconnected graph
- network analysis
Learn next
Compare harmonic centrality with degree and closeness centrality on the same small network. Then reverse a directed graph and explain how incoming accessibility becomes outgoing accessibility. Record raw and normalized values separately to keep their interpretation clear.
More in Graphs and symbolic AI
- Grid search - Grid search is a systematic way to evaluate every combination in a predefined set of candidate parameter values.
- Ground term - A ground term is a term in formal logic that contains no variables.
- Grover's algorithm - Grover's algorithm is a quantum algorithm for finding a marked item in an unstructured search space.
- Hash function - A hash function maps an input to a compact value used for purposes such as indexing, comparison, or verification.
- Hebbian learning - Hebbian learning is a family of learning ideas in which a connection changes according to the activity of the units it connects.
- Heuristic - A heuristic is a practical rule or method used to reach a useful answer or guide a decision with limited effort.
Sources
Sources: NetworkX, harmonic_centrality documentation: https://networkx.org/documentation/stable/reference/algorithms/generated/networkx.algorithms.centrality.harmonic_centrality.html
Previous: Harmful bias Next: Harmonic function