Degree centrality

Introduction to Network Analysis in Python

Eric Ma

Data Carpentry instructor and author of nxviz package

Important nodes

  • Which nodes are important?
    • Degree centrality
    • Betweenness centrality
Introduction to Network Analysis in Python

Important nodes

  • Which center node might be more important?

Two graphs with one central node connected to all other nodes. The left-hand graph's central node is connected to eight other nodes. The right-hand graph's central node is connected to three other nodes.

Introduction to Network Analysis in Python

Important nodes

Which center node might be more important?

The same image of two star graphs as before, with the left-hand graph highlighted.

Introduction to Network Analysis in Python

Degree centrality

  • Definition:

$$\frac{\text{Number of Neighbors I Have}}{\text{Number of Neighbors I Could Possibly Have}}$$

  • Examples of node with high degree centrality:

    • Twitter broadcasters

    • Airport transportation hubs

    • Disease super-spreaders

Introduction to Network Analysis in Python

Number of neighbors

G.edges()
EdgeView([(1, 2), (1, 3), (1, 4), (1, 5), (1, 6), (1, 7), (1, 8), (1, 9)])
list(G.neighbors(1))
[2, 3, 4, 5, 6, 7, 8, 9]
list(G.neighbors(8))
[1]
list(G.neighbors(10))
NetworkXError: The node 10 is not in the graph.
Introduction to Network Analysis in Python

Degree centrality

nx.degree_centrality(G)
{1: 1.0,
 2: 0.125,
 3: 0.125,
 4: 0.125,
 5: 0.125,
 6: 0.125,
 7: 0.125,
 8: 0.125,
 9: 0.125}
Introduction to Network Analysis in Python

Let's practice!

Introduction to Network Analysis in Python

Preparing Video For Download...