09: Medici Family Influence#
This week we’ll explore how people in a network adopt new behaviors, using a model to describe diffusion and cascades. We’ll 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?
In a short Jupyter notebook report, complete the following tasks. Don’t simply calculate the answers: make sure you’re fully explaining (in writing) the metrics and visualizations that you generate. Consider the Criteria for Good Reports as a guide. You can create markdown cells with section headers to separate the different sections of the report. Rather than number the report as if you’re answering distinct questions, use the questions as a guide to do some data storytelling, i.e. explain this network’s data in an organized way.
Complete the exercise about the Medici that we began last time (the steps are listed below), and put all your code and explanations into this network. How did the Florentine families network respond to the new behavior introduced by the Medici? Was there a complete cascade? Why or why not?
a. Load the
florentine_families_graph()
sample network from NetworkX and visualize it withnx_altair
. Based on the visualization, do you think there will be a complete cascade? Why or why not?
b. 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).
c. Create a new node attribute for your network and call itbehavior
. 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.
d. Visualize the network withnx_altair
, using the behavior attribute as node color.
e. 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’sbehavior
attribute should be changed from 0 to 1.
f. Rerun your cascade function a few times, and each time rerun your drawing function to update the colors. (You may need yourbehavior
attribute to be a string or categorical variable for the colors to display properly.) What happened with your cascade? Was it a complete cascade? Why or why not?
g. 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 in your node dataframe. 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?In the chapter and in class, we learned that dense clusters in the network are the only thing that can stop a cascade. Specifically we learned that the clusters must be more dense than \(1-q\) (or
1 - the threshold
). Can you find such a cluster in the Florentine families graph? You may have to combine some approaches we’ve used in previous weeks. Explain the steps you took and interpret your results: was there a dense enough cluster to stop the cascade, and if so which families are in this cluster?Finally, we learned how to extend our model to include a bilingual option, or a scenario in which a person might adopt both behaviors instead of simply choosing one or the other. Can you modify your cascade function to allow for a third option in which a family adopts both behaviors? In this scenario, set the cost of adopting both behaviors to 1, so \(c=1\). Once you’ve modified your function, rerun your visualization and your Pandas dataframe to include the bilingual option. (Hint: you may not be able to use numbers to indicate the behaviors anymore.) Again, explain the steps and interpret the results. Does every node in the graph eventually adopt the bilingual option? Why or why not?
When you’re finished, remove these instructions from the top of the file, leaving only your own writing and code. Export the notebook as an HTML file, check to make sure everything is formatted correctly, and submit your HTML file to Sakai.