Introduction to graph differences

Intermediate Network Analysis in Python

Eric Ma

Data Carpentry instructor and author of nxviz package

Time series analysis

ch3-1_v2.003.png

Intermediate Network Analysis in Python

Time series analysis

  • How some number changes as a function of time
    • Is there an upward or downward trend?
  • Rate of change of things over a sliding window of time
  • Examples:
    • Tracking weight over time
    • Tracking stock investment portfolio value over time
Intermediate Network Analysis in Python

Evolving graphs

  • Graphs that change over time: communication networks
  • Assumptions:
    • Edge changes over time; assume nodes stay constant
    • Both edges and nodes change over time
Intermediate Network Analysis in Python

Graph differences

  • Graphs are comprised of:
    • A node set
    • An edge set
  • If a node set doesn’t change:
    • Changing only the edge set will result in a change in the graph
Intermediate Network Analysis in Python

Graph differences

  • Analogy: set differences

ch3-1_v2.026.png

  • In NetworkX: .difference(G1, G2) function
    • Assumes G1 and G2 have equal node sets
Intermediate Network Analysis in Python

Graph differences in Python

list(G1.edges())
[('cust1', 'cust2'), ('cust3', 'cust2')]
list(G2.edges())
[('cust1', 'cust3'), ('cust3', 'cust2')]
G2minusG1 = nx.difference(G2, G1)

G1minusG2 = nx.difference(G1, G2)
Intermediate Network Analysis in Python

Let's practice!

Intermediate Network Analysis in Python

Preparing Video For Download...