In-class Exercise: Cascades

You’ll work on this in class on Tuesday, and a version of these questions will be part of your homework for Thursday.

Let’s look at cascading behavior in a network of Florentine families in the Renaissance. We know that the Medici were the most powerful and influential family in Florence during the Renaissance. What happens if the Medici and just one other family adopt a new fashion? Will all the families adopt it? Or will the cascade be blocked?

  1. Load the florentine_families_graph() sample network from NetworkX and visualize it with the draw function. Based on the visualization, do you think there will be a complete cascade? Why or why not?
  2. Let’s assume two behaviors, A and B. The payoff for behavior A should be 3, and the payoff for behavior B is 2. We want to know how long it will take others in the network to switch from behavior B to A. Write a short function to calculate the threshold value (p).
  3. Create a new node attribute for your network and call it behavior. Set the value for Medici and Guadagni to 1, but set all the rest to 0. 0 will represent behavior B and 1 will represent behavior A.
  4. Visualize the network with draw(), using the behavior attribute as node color.
  5. Write a function to iterate one “cascade step” in your network. The function should look at a nodes neighbors to determine if the ratio of neighbors that have adopted A is higher than the threshold. If it is, that node’s behavior attribute should be changed from 0 to 1.
  6. Rerun your cascade function a few times, and each time rerun your drawing function to update the colors. What happened with your cascade? Was it a complete cascade? Why or why not?
  7. Going back to your original code, write a loop that runs the cascade 5 times, each time putting the behavior value into a new column. This will let you see when particular nodes flipped from behavior B (0) to behavior A (1). How many steps did it take before the cascade stabilized?

Updated: