Zooming in & zooming out: Overall graph summary

Intermediate Network Analysis in Python

Eric Ma

Data Carpentry instructor and author of nxviz package

Graph exploration at scales

  • Exploration at global and local scales

  • Global: Centrality distributions

  • Local: Connectivity and structures

Intermediate Network Analysis in Python

Zooming on nodes

  • Isolate a given node or set of nodes

  • Plot node statistic over time

Intermediate Network Analysis in Python

Summarizing evolving node statistics

  • Customer-product dataset
    • Investigate how purchasing patterns have changed over time
  • customer1 - node of interest
Intermediate Network Analysis in Python

Summarizing evolving node statistics

Gs = [....] 

noi = 'customer1'
degs = []
for g in Gs: ... # Get the degree of the node degs.append(len(g.neighbors(noi)))
plt.plot(degs) plt.show()
Intermediate Network Analysis in Python

Summarizing evolving node statistics

ch3-3.020.png

Intermediate Network Analysis in Python

Default dictionaries

from collections import defaultdict
d = defaultdict(list)

d['heathrow'].append(0.31) d['heathrow'].append(0.84)
d
defaultdict(list, {'heathrow': [0.31, 0.84]})
Intermediate Network Analysis in Python

Default dictionaries

d2 = dict()
d2['heathrow'].append(0.31)
KeyError                           Traceback (most recent call last)
<ipython-input-19-291c74368a8f> in <module>()
--> 1 d2['heathrow'].append(0.31)
KeyError: 'heathrow'
Intermediate Network Analysis in Python

Let's practice!

Intermediate Network Analysis in Python

Preparing Video For Download...