Case study!

Introduction to Network Analysis in Python

Eric Ma

Data Carpentry instructor and author of nxviz package

Data

  • Github user collaboration network
  • Nodes: users
  • Edges: collaboration on same GitHub repository
  • Goals:
    • Analyze structure
    • Visualize
    • Build simple recommendation system
Introduction to Network Analysis in Python

Graph properties

import networkx as nx
G = nx.erdos_renyi_graph(n=20, p=0.2)

len(G.edges())
29
len(G.nodes())
20
Introduction to Network Analysis in Python

Graph properties

nx.degree_centrality(G)
{0: 0.15789473684210525,
 1: 0.15789473684210525,
 2: 0.15789473684210525,
 3: 0.10526315789473684,...
nx.betweenness_centrality(G)
{0: 0.01949317738791423,
 1: 0.060916179337231965,
 2: 0.1276803118908382,
 3: 0.03313840155945419,...
Introduction to Network Analysis in Python

Data

  • Number of nodes
  • Number of edges
  • Degree centrality distribution
  • Betweenness centrality distribution
Introduction to Network Analysis in Python

Let's practice!

Introduction to Network Analysis in Python

Preparing Video For Download...