Skip to main content

Graph Centrality & Metrics

Understanding node importance through centrality measures, shortest paths, hop distances, clustering coefficients, and fundamental graph metrics

Which node is well connected, which is easy to reach, and which carries shortest paths? Those are different questions. The nine-node graph is an undirected 3×3 grid: nodes A through I are connected only by the drawn horizontal and vertical edges.

Start at E and inspect hop distances. E has four of eight possible neighbors, so normalized degree is 0.5. Its normalized betweenness is 0.380952 because alternative shortest paths share credit. The table calculates every measure from the same edges, while the path view gives a valid traversal A → B → C → F → E → D → G → H → I.

Graph metrics

Calculated graph distances and centralities

Undirected 9-node grid. Degree is divided by 8; betweenness sums fractions of shortest paths and uses the 28 unordered pairs excluding each node. Eigenvector scores have unit L2 norm. Hamiltonian example: A → B → C → F → E → D → G → H → I; every step is an existing edge. Diameter = 4; mean distance across distinct node pairs = 2; every local clustering coefficient is 0 because this grid has no triangles.

Scroll the table horizontally to inspect all columns.

NodeHops from sourceDegreeClosenessBetweennessEigenvector
A20.2500000.4444440.0476190.250000
B10.3750000.5333330.1785710.353553
C20.2500000.4444440.0476190.250000
D10.3750000.5333330.1785710.353553
E00.5000000.6666670.3809520.500000
F10.3750000.5333330.1785710.353553
G20.2500000.4444440.0476190.250000
H10.3750000.5333330.1785710.353553
I20.2500000.4444440.0476190.250000

Graph paths from E

Graph Distance Concepts

Hop Distance

The hop distance (or geodesic distance) between two nodes is the minimum number of edges in any path connecting them. It's the fundamental distance metric in unweighted graphs.

Shortest Path

The path with minimum hop distance between two nodes. Multiple shortest paths may exist. Key algorithms:

  • BFS: For unweighted graphs
  • Dijkstra: For weighted graphs with non-negative weights
  • Floyd-Warshall: All-pairs shortest paths

Graph Diameter

The maximum shortest path length between any two nodes. Indicates the "width" of the graph.

Centrality Measures

Degree Centrality

text
C_degree(v) = degree(v) / (n-1)
  • Measures: Direct connections
  • Identifies: Highly connected hubs
  • Use Case: Social influence, popular users

Closeness Centrality

text
C_closeness(v) = (n-1) / Σ d(v,u)
  • Measures: Average distance to all nodes
  • Identifies: Nodes that can quickly reach others
  • Use Case: Facility location, information spread

Betweenness Centrality

text
C_betweenness(v) = Σ σ_st(v) / σ_st
  • Measures: Fraction of shortest paths through node
  • Identifies: Bridge nodes, bottlenecks
  • Use Case: Critical infrastructure, gatekeepers

Eigenvector Centrality

text
x_v = (1/λ) Σ x_u for u ∈ N(v)
  • Measures: Importance based on neighbor importance
  • Identifies: Influential nodes in networks
  • Use Case: PageRank, influence propagation

Path Types

Simple Path

No repeated vertices. Most paths in analysis are simple paths.

Cycle

Path that starts and ends at the same vertex. Indicates feedback loops.

Hamiltonian Path

Visits each vertex exactly once. NP-complete to find.

Eulerian Path

Uses each edge exactly once. Exists if graph has 0 or 2 odd-degree vertices.

Clustering Coefficient

Local Clustering Coefficient

text
CC(v) = 2e / (k(k-1))

Where:

  • e = edges between v's neighbors
  • k = degree of v

Measures how connected a node's neighborhood is.

Global Clustering Coefficient

Average of all local clustering coefficients. Indicates overall clustering tendency.

Transitivity

text
T = 3 × (number of triangles) / (number of connected triples)

Alternative global measure weighted by high-degree nodes.

Graph Properties

Connectivity

  • Connected: Path exists between all node pairs
  • k-Connected: Remains connected after removing k-1 nodes
  • Components: Maximal connected subgraphs

Density

text
Density = 2|E| / (|V|(|V|-1))

Ratio of actual edges to possible edges.

Degree Distribution

  • Regular: All nodes have same degree
  • Power Law: P(k) ∼ k^(-γ), scale-free networks
  • Poisson: Random graphs

Applications

Social Networks

  • Identify influencers (high centrality)
  • Detect communities (clustering)
  • Predict information spread (paths)

Transportation

  • Find critical intersections (betweenness)
  • Optimize routes (shortest paths)
  • Measure accessibility (closeness)

Biology

  • Protein interaction networks
  • Gene regulatory networks
  • Neural connectivity

Web & Internet

  • PageRank (eigenvector centrality)
  • Network robustness (connectivity)
  • Routing optimization

Computational Complexity

MetricTime Complexity
Degree CentralityO(1) per node
BFS/DFSO(V + E)
Shortest Path (Dijkstra)O((V + E) log V)
All-Pairs Shortest PathO(V³)
Betweenness CentralityO(VE)
Clustering CoefficientO(V × d²)

Best Practices

  1. Choose Appropriate Centrality: Different measures capture different importance aspects
  2. Consider Graph Type: Directed vs undirected, weighted vs unweighted
  3. Normalize Measures: For comparing across different graphs
  4. Use Approximations: For large graphs (sampling, parallel algorithms)
  5. Combine Metrics: Multiple centralities give fuller picture

What comes next

These structural quantities describe connectivity. Graph embeddings next turns sampled neighborhoods into training examples for vector representations.

Deep Learning
Adaptive Tiling: Efficient Visual Token Generation

Explore an illustrative region-tiling policy: resize tiles, calculate visual tokens, and distinguish analytical savings from measured model quality.

Deep Learning
Batch Normalization in Deep Learning

Learn batch normalization in deep learning: how normalizing layer inputs accelerates training, improves gradient flow, and acts as regularization.

Deep Learning
Batch Norm vs Layer Norm: When to Use Which

BatchNorm normalizes over the batch and spatial axes; LayerNorm normalizes over the channel and spatial axes for each sample. The choice changes whether your model trains stably with batch=1, depends on batch composition at inference, and behaves consistently across train and eval.

Deep Learning
Calinski-Harabasz Index: The Variance Ratio Criterion

How the Calinski-Harabasz index evaluates clustering quality by measuring the ratio of between-cluster to within-cluster variance — fast, intuitive, and ideal for k-selection with convex clusters.

Deep Learning
Representation Collapse in Self-Supervised Learning

Understanding complete, dimensional, and cluster collapse — the failure modes that every self-supervised method must prevent. Learn why collapse happens and how contrastive, asymmetric, regularization, and masking approaches solve it.

Deep Learning
Contrastive Loss for Representation Learning

Understand contrastive loss for representation learning: interactive demos of InfoNCE, triplet loss, and embedding space clustering with temperature tuning.

If you found this explanation helpful, consider sharing it with others.

Mastodon