
Betweenness Centrality and Other Essential Centrality Measures in Network Analysis
Betweenness centrality measures how often a node lies on the shortest paths between other nodes. Nodes with high betweenness act as bridges, so they control much of the flow of information or resources through a network. It's one of several centrality measures, alongside degree, closeness, eigenvector, Katz, and PageRank centrality. Each one answers a different question about which nodes matter most.
What Is Centrality?
Centrality is a family of measures that score how important each node (vertex) is within a network. Networks can represent social interactions, transportation systems, payments, or online communication.
Centrality helps you find the nodes that act as key connectors, information brokers, or potential bottlenecks. Different measures define "important" differently, so the right one depends on your question.
Understanding Betweenness Centrality
Betweenness centrality assesses a node's control over the flow of information, communication, or resources between other nodes. A node with high betweenness sits on many of the shortest routes between others. If you removed it, many connections would get longer or break.
Formally, take every pair of other nodes s and t. For each pair, find the fraction of shortest paths from s to t that pass through v. The betweenness of v is the sum of those fractions:
BC(v) = Σ σst(v) / σst (for all pairs s ≠ v ≠ t)Here, σst is the number of shortest paths between s and t, and σst(v) is the number of those paths that pass through v. Scores are often normalized so you can compare graphs of different sizes.
Betweenness Centrality Algorithm
Betweenness centrality is a fundamental algorithm in network analysis. It identifies nodes that act as bridges or critical intermediaries because they lie on many shortest paths.
A naive approach would compute every shortest path between every pair of nodes, which is slow on large graphs. Most implementations use Brandes' algorithm from 2001 instead. It runs a breadth-first search (BFS) from each node in unweighted graphs, or Dijkstra's algorithm in weighted graphs, to compute shortest paths. It then accumulates each node's share of those paths. For unweighted graphs, this takes O(nm) time, where n is the number of nodes and m the number of relationships.
Applications of Betweenness Centrality
Social networks: People with high betweenness often connect different social circles. They control how information spreads between otherwise separate groups.
Transportation networks: Nodes with high betweenness can represent crucial intersections or hubs in transportation networks. Congestion or disruption at these nodes can cause delays throughout the network.

Communication and infrastructure networks: Betweenness helps explain how information spreads through online platforms. In IT and telecom networks, it points to the routers, services, or links that would cause the widest outage if they failed.
Fraud detection: Centrality scores are useful risk signals. An account with unusually high betweenness may be moving money between groups that otherwise have no contact. Read more about fraud detection with Memgraph.
AI agents: When an agent's possible actions are modeled as a graph, betweenness flags the steps that every plan passes through. Those steps deserve the most monitoring and testing.
Betweenness Centrality in Unweighted vs. Weighted Graphs
Unweighted Graphs
In unweighted graphs, all relationships count equally. The shortest path between two nodes is the one with the fewest hops, and betweenness counts how many of those paths pass through each node.
For example, in an unweighted social network, a person with high betweenness frequently links different social groups. In a transportation network, a node with high betweenness might be a junction that connects many routes.
Weighted Graphs
Weighted graphs assign a value to each relationship, such as distance, travel time, or cost. Here, the shortest path is the one with the lowest total weight, not the fewest hops.
Betweenness still counts the share of shortest paths that pass through a node. The weights only change which paths count as shortest. A node can have high betweenness in the unweighted version of a graph but low betweenness once weights are applied.
Weights must represent a cost or distance, where lower is better. If your weights represent strength, such as how close two friends are, convert them first, for example with 1 / strength. Otherwise, the algorithm treats the weakest ties as the shortest paths.
Other Essential Centrality Measures
Betweenness centrality is a cornerstone of network analysis, but it answers only one question. Other centrality measures shed light on different aspects of a node's importance.
Degree Centrality
Degree centrality counts how many connections a node has. It's the simplest centrality measure. Nodes with high degree centrality are often called hubs, because they connect directly to many other nodes.
In directed graphs, you can count incoming connections (in-degree) and outgoing connections (out-degree) separately. In a social network, high in-degree might mark a popular account, while high out-degree might mark a very active one.
High-degree nodes can spread information quickly to a wide audience. Degree centrality only looks at direct neighbors, though, so it misses a node's wider position in the network.
The degree, eigenvector, and PageRank examples in this post use the same network, so you can compare how each measure ranks its nodes.

Closeness Centrality
Closeness centrality measures how near a node is to all other nodes. It's the reciprocal of the average shortest-path distance from the node to every other node. A short average distance means a high closeness score.
Nodes with high closeness can reach the rest of the network quickly. This makes the measure useful wherever speed matters, such as transportation systems and emergency response networks.
Closeness is hard to compute in graphs that aren't fully connected, because some distances are infinite. A common variant, harmonic centrality, sums the reciprocals of distances instead.

Eigenvector Centrality
Eigenvector centrality considers both the number and the quality of a node's connections. A node scores high when it's connected to other high-scoring nodes.
In other words, a node linked to influential nodes has higher eigenvector centrality. Such a node might not have many connections, but the ones it has are influential. This makes eigenvector centrality useful for finding nodes with indirect influence through key players.

Katz Centrality
Katz centrality extends this idea by counting walks of every length from a node, with longer walks counting less. An attenuation factor, smaller than 1, shrinks the weight of each extra step. Close connections matter most, but distant ones still contribute.
Katz centrality works well on directed graphs, where eigenvector centrality can break down. It's also a common risk signal in fraud detection.
PageRank Centrality
PageRank originated as Google's algorithm for ranking web pages by their incoming links. In general networks, it scores a node by both the number and the importance of the nodes that link to it.
PageRank is a variant of eigenvector centrality. It adds a damping factor, the probability that a random surfer keeps following links rather than jumping to a random node. The common default is 0.85.
PageRank is widely used for web pages, citation networks, and recommendations. In GraphRAG, it helps rank which nodes to retrieve as context for an LLM.

Which Centrality Measure Should You Use?
| Question you're asking | Measure to use |
|---|---|
| Which nodes act as bridges or bottlenecks? | Betweenness centrality |
| Which nodes have the most direct connections? | Degree centrality |
| Which nodes can reach everyone else fastest? | Closeness centrality |
| Which nodes are connected to other influential nodes? | Eigenvector or Katz centrality |
| Which nodes matter most based on who links to them? | PageRank |
In practice, analysts often combine several measures. For example, a node with high betweenness but low degree is a quiet bridge, which is easy to miss and costly to lose.
How to Calculate Centrality in Memgraph
Memgraph includes fast C++ implementations of betweenness, degree, Katz, and PageRank centrality in its algorithm library. You call them from Cypher.
For example, this query returns the 10 nodes with the highest betweenness centrality, ignoring relationship direction and normalizing the scores:
CALL betweenness_centrality.get(FALSE, TRUE)
YIELD node, betweenness_centrality
RETURN node, betweenness_centrality
ORDER BY betweenness_centrality DESC
LIMIT 10;The built-in betweenness procedure works on unweighted graphs and runs in parallel. For weighted betweenness, you can use the NetworkX-based nxalg.betweenness_centrality() procedure with a weight property.
For graphs that change constantly, Memgraph Enterprise includes dynamic versions, such as betweenness_centrality_online, katz_centrality_online, and pagerank_online. They update scores as data changes instead of recomputing the whole graph.
Curious to learn more about graphs, or have a question about Memgraph? Join our Discord community.