Betweenness Centrality for Graph-Based Influence Analysis
Betweenness
graph
Centrality
- Betweenness Centrality for Graph-Based Influence Analysis
- Overview
- Goals
- Technical explanation
- Methodology
- Limitation
- The Code

Overview
Understanding the structure of a network requires more than counting the number of connections between entities. Some nodes play a more important role because they connect different parts of the network. Betweenness Centrality helps identify these nodes by measuring how frequently they appear on the shortest paths between other nodes.
This analysis applies the Betweenness Centrality algorithm to a projected graph. The projection defines the nodes and relationships that are relevant to the analysis. It provides a focused representation of the network and allows the algorithm to evaluate the structural importance of each node.
Goals
The main objective is to identify nodes that connect different groups or network components (Degree centrality). Degree centrality measures the number of direct connections that a node has. Betweenness Centrality measures the node’s position within the wider network. These nodes may represent important communication channels, structural bottlenecks, or critical dependencies.
A node does not need to have many direct connections to achieve a high score. A node with only a few connections can still be structurally important if it links otherwise separate parts of the network.
This analysis provides a basis for investigating network connectivity, identifying potential single points of failure, and understanding how dependencies are distributed across the graph.
Expected Outcomes
- Influential intermediary identification: Identify nodes that frequently connect different parts of the network.
- Bottleneck detection: Highlight nodes that may restrict connectivity or information flow.
- Dependency assessment: Identify entities that occupy important positions in network dependency paths.
- Network structure analysis: Understand how different groups and components are connected.
- Further graph analysis: Use centrality scores as additional attributes for network visualization and structural assessment.
Technical explanation
In a graph, nodes represent entities and relationships represent connections between them. Some nodes have a more important position because they connect different parts of the network. These nodes can act as bridges between otherwise disconnected groups.
Betweenness Centrality identifies these nodes by measuring how frequently they occur on shortest paths between pairs of other nodes. A node with a high score has a strong intermediary position in the network.
The algorithm uses the following principle:
$C_B(v)=\sum_{s\neq v\neq t}\frac{\sigma_{st}(v)}{\sigma_{st}}$
Where:
- $C_B(v)$: Betweenness Centrality score of node $v$.
- $\sigma_{st}$: Number of shortest paths between nodes $s$ and $t$.
- $\sigma_{st}(v)$: Number of shortest paths between nodes $s$ and $t$ that pass through node $v$.
The algorithm calculates the contribution of each node across all pairs of other nodes. A higher score indicates that more shortest paths pass through that node.
Methodology
- Graph projection: The analysis starts by creating a graph projection from the underlying graph data. Relevant node labels and relationship types are selected to represent the network structure. This step ensures that the algorithm evaluates the intended connections rather than unrelated relationships in the database.
- Prepare the graph: Check relationship direction, connectivity, and edge properties. Decide whether the analysis requires a directed or undirected graph.
- Calculates the shortest paths: Betweenness Centrality calculates the shortest paths between pairs of nodes. It assigns a score to each node based on the proportion of these paths that pass through it. Nodes with higher scores have a stronger intermediary position within the network.
- Assign centrality scores: Store the resulting scores as node properties or return them as algorithm results.
- Rank nodes: The resulting scores are then used to rank nodes and identify important connection points. These results can also be stored as node properties for further analysis, filtering, and visualization.
Limitation
The results depend on the graph projection, relationship direction, and weight configuration. For large networks, approximate computation through node sampling can reduce processing time. The resulting scores should be interpreted together with the underlying node types and relationship semantics.
Betweenness Centrality measures structural importance based on shortest paths. It does not directly measure authority, business influence, or the actual impact of removing a node.
The Code
Assuming the Neo4j dataset is active and able to called by python library. By calling gds.betweenness, we could calculate betweeness value for each nodes and return which nodes that have higher / lower value in top n.
Generate projection
target = "AggregationSwitch,ApplicationService ..."
relation = "ACCESS_PATH,AUTHENTICATES ..."
with driver.session(database=NEO4J_DATABASE) as session:
gds.project_graph(session, target, relation, GRAPH_NAME)
Calculate betweenness
result = gds.betweenness(connector_params,
types='manual', graph_name=GRAPH_NAME,
target=target, relation=relation,
id="entity_id", limit=10, descending=True)
This function requires the following parameters:
- connector_params (
list): [URI, NEO4J_DATABASE, USERNAME, PASSWORD] - types (
string): manual, gds, gds_write - target (
string): list of node in string format - relation (
string): list of relationship in string format - graph_name (
string): name of graph projection - id (
string): ID name for each node - limit (
int): limit of top n - descending (
bolean): is descending
Output
Projected graph: Graph: gds-example-graph | Nodes: 200 | Relationships: 751 | Projection_time: 20 ms
Node properties written: 200
Compute time (ms): 48
Write time (ms): 81
Centrality distribution: {'p99': 1073.2343139648438, 'min': 0.0, 'max': 1242.6093749999998, 'p90': 249.68450927734375, 'mean': 128.77002136230467, 'p50': 65.70599365234375, 'p999': 1242.6093139648438, 'p95': 372.53118896484375, 'p75': 141.39739990234375}
| no | entity_id | name | betweenness |
|---|---|---|---|
| 0 | UPS-003 | Ups 03 | 1242.609 |
| 1 | UPS-002 | Ups 02 | 1118.826 |
| 2 | UPS-004 | Ups 04 | 1073.227 |
| 3 | UPS-001 | Ups 01 | 959.6898 |
| 4 | UPS-005 | Ups 05 | 897.6389 |
| 5 | PNL-003 | Distribution Panel 03 | 750.254 |
| 6 | PNL-002 | Distribution Panel 02 | 645.4941 |
| 7 | PNL-004 | Distribution Panel 04 | 585.9857 |
| 8 | PNL-001 | Distribution Panel 01 | 562.9572 |
| 9 | PNL-005 | Distribution Panel 05 | 537.4423 |