Skip to main content

Centrality and Its Failure Modes

Centrality is a family of question-specific structural summaries, not a single measure of who matters. Degree counts incident ties, closeness summarizes modeled distances, and betweenness counts shortest-path participation. They can disagree because they encode different claims.

Prerequisites​

Complete shortest paths and distance. This lesson reuses the same valid-event filter and parallel-edge aggregation but uses unweighted paths for closeness and betweenness.

Learning goals​

  • State what degree, closeness, and betweenness count.
  • Distinguish incoming from outgoing closeness in a directed graph.
  • Explain normalization and disconnected-graph behavior.
  • Diagnose self-loop, parallel-edge, missing-edge, and semantic failure modes.

Analysis contract​

  • Graph type: the directed simple graph after parallel-edge aggregation; the self-loop remains for degree, while unweighted shortest paths drive closeness and betweenness.
  • Normalization: degree divides total directed degree by n−1n-1; NetworkX's improved closeness scales by the reachable fraction; betweenness is normalized over eligible ordered pairs with endpoints excluded.
  • Disconnected case: unreachable nodes do not contribute a finite distance; improved closeness penalizes small reachable sets, betweenness stays zero when no eligible shortest path crosses a node, and Gia receives zero.
  • Interpretation limit: every score is structural evidence, not social importance, merit, influence, power, or causality.

Three questions, three metrics​

Directed degree combines in- and out-degree in nx.degree_centrality. A self-loop contributes to both, and multigraph parallel edges can make the usual simple-graph normalization exceed one. We aggregate parallel edges first, but Eli's self-loop still contributes twice.

NetworkX incoming closeness on a directed graph uses distances into a node. Applying it to a reversed view answers the outgoing-distance question. The default Wasserman–Faust correction multiplies by the fraction of all other nodes that are reachable, so values across disconnected components are not raw reciprocals of within-component average distance.

Betweenness assigns fractional credit when multiple shortest paths tie. Here it uses hop paths (weight=None) and excludes endpoints. Supplying reciprocal-strength cost would define a different measure.

Worked example​

import csv
from pathlib import Path

import networkx as nx

fixture = Path("tests/fixtures/graph-data-science")
with (fixture / "interaction-nodes.csv").open(encoding="utf-8") as handle:
node_ids = [row["node_id"] for row in csv.DictReader(handle)]
with (fixture / "interaction-relationships.csv").open(encoding="utf-8") as handle:
rows = [row for row in csv.DictReader(handle) if row["record_status"] == "valid"]

graph = nx.DiGraph()
graph.add_nodes_from(node_ids)
for row in rows:
graph.add_edge(row["source"], row["target"])

degree = nx.degree_centrality(graph)
incoming = nx.closeness_centrality(graph, distance=None, wf_improved=True)
outgoing = nx.closeness_centrality(graph.reverse(copy=False), distance=None, wf_improved=True)
between = nx.betweenness_centrality(graph, normalized=True, weight=None, endpoints=False)
degree_top = sorted(degree.items(), key=lambda item: (-item[1], item[0]))[:3]
between_top = max(between.items(), key=lambda item: (item[1], item[0]))
print(f"degree_top={[(node, round(score, 3)) for node, score in degree_top]}")
print(f"in_closeness_ada={incoming['ada']:.3f} out_closeness_ada={outgoing['ada']:.3f}")
print(f"betweenness_top={(between_top[0], round(between_top[1], 3))} isolate={between['gia']:.3f}")

Expected output:

degree_top=[('eli', 0.667), ('ada', 0.5), ('ben', 0.5)]
in_closeness_ada=0.375 out_closeness_ada=0.347
betweenness_top=('ben', 0.267) isolate=0.000

Eli leads this degree convention partly because of a self-loop, while Ben leads hop betweenness. Neither statement establishes real-world importance.

Limitations​

  • Rankings can reverse after changing direction, weight meaning, self-loop policy, or normalization.
  • Betweenness assumes modeled shortest paths are the relevant routes; actual movement may follow none of them.
  • Missing bridges can inflate or erase betweenness, and missing peripheral ties can distort every denominator.
  • Centrality distributions are often unstable under plausible graph-construction choices; report sensitivity, not only a top list.

Practice​

Remove the self-loop and recompute degree. Then calculate outward closeness without reversing the graph by mistake, and explain why the two operations answer different questions.

Next steps​

Continue to community detection, where a whole partition depends on similarly consequential graph and objective choices.

Primary sources​

Checked 2026-10-18: NetworkX, centrality reference; NetworkX, closeness_centrality; NetworkX, betweenness_centrality; L. C. Freeman, Centrality in social networks: Conceptual clarification.