Betweenness centrality

Introduction to Network Analysis in Python

Eric Ma

Data Carpentry instructor and author of nxviz package

All shortest paths

  • Set of paths
  • Each path is shortest path between a given pair of nodes
  • Done for all node pairs
Introduction to Network Analysis in Python

Betweenness centrality

  • Definition:

$$\frac{\text{num. shortest paths through node}}{\text{all possible shortest paths}}$$

  • Application:
    • Bridges between liberal- and conservative-leaning Twitter users
    • Critical information transfer links
Introduction to Network Analysis in Python

Examples

  • Singapore: Raffles Place & Jurong East

Map of the Singapore subway system

1 Source: https://www.seacitymaps.com/singapore/singapore_mrt_map.jpg
Introduction to Network Analysis in Python

Example

  • High betweenness centrality, low degree centrality?

A barbell graph. There are two groups of nodes each with lots of connections between the nodes. The two groups of nodes only have a single path connecting them.

Introduction to Network Analysis in Python

Betweenness centrality

import networkx as nx
G = nx.barbell_graph(m1=5, m2=1)

nx.betweenness_centrality(G)
{0: 0.0,
 1: 0.0,
 2: 0.0,
 3: 0.0,
 4: 0.5333333333333333,
 5: 0.5555555555555556,
 6: 0.5333333333333333,
 7: 0.0,
 8: 0.0,
 9: 0.0,
 10: 0.0}

The same barbell graph as before

Introduction to Network Analysis in Python

Betweenness centrality

import networkx as nx
G = nx.barbell_graph(m1=5, m2=1)

nx.betweenness_centrality(G)
{0: 0.0,
 1: 0.0,
 2: 0.0,
 3: 0.0,
 4: 0.5333333333333333,
 5: 0.5555555555555556,
 6: 0.5333333333333333,
 7: 0.0,
 8: 0.0,
 9: 0.0,
 10: 0.0}

The same barbell graph as before, with the nodes on the path between the two groups of nodes highlighted.

Introduction to Network Analysis in Python

Let's practice!

Introduction to Network Analysis in Python

Preparing Video For Download...