Exercise

Graph differences over time

Now, you'll compute the graph differences over time! To look at the simplest case, here you'll use a window of (month, month + 1), and then keep track of the edges gained or lost over time. This exercise is preparation for the next exercise, in which you will visualize the changes over time.

Instructions

100 XP
  • Inside the for loop:
    • Assign Gs[i] to g1 and Gs[i + window] to g2.
    • Using nx.difference() compute the difference between g2 and g1. Append the result to added.
    • Append the difference between g1 and g2 to removed.
  • Print fractional_changes.