teaching with "Networks, Crowds, and Markets: Reasoning About a Highly Connected World" (by David Easley and Jon Kleinberg)

a collection of complementary in-class activities by Lada Adamic

In Winter of 2011 I taught SI 301 ("Models of Social Information Processing") a course that is part of the undergraduate informatics curriculum at the School of Information at the University of Michigan. The course had no prerequisites, the enrollment was ~50, and laptops were required in class. My task was to teach material from this book, which I did, supplementing it with in-class activities designed to engage the students and bring some of the text to life. Sometimes they involved pencil, paper, cards, and some spare change, but most of the time they were online interactive demos, implemented in NetLogo or Guess or Perl. I'm sharing them here, in case they are of use to others teaching with the text. The activities below are ordered by how much fun *I* had during the class. Your results may vary!

• Chapter 12. Bargaining and Power in Networks
•  If you are like me, you may have upwards of \$20 lying around in change. This is perfect for conducting a "bargaining and power in networks" in-class experiment. The game is played as follows. Each tie/edge has the potential to split some amount of money (in my class we had 50¢ per edge), and the split has to be agreed upon by the parties on either side of the edge. Each person can only participate in one trade, so e.g. in the network on the blue sheet, B can choose to trade with either A or C. I split the change into 5 ziplocks with the networks drawn on them (the networks with more edges got a bit more change) and a good mix of quarters, dimes, nickles and pennies. The change stretched into 5 rounds. Each student received a numbered post-it (1,2,3,4,5,...) and I used R to generate a random sequence of those integers and overlaid them on the networks. The students' post-its told them which network they had been randomly assigned to (some students were left out). After 3 rounds, we switched so that the students who did not have an opportunity to bargain could do so. At the conclusion of each round, the students would pocket the change that they had earned. From the "games" activity from Chapter 6, I knew that my students were quite resourceful in coordinating and had an altruistic tendency. Thus for this exercise, I was not only careful to assign them into groups randomly, but also told the students to maximize their own payoffs. After all, they would get to keep the money that they bargained for. The results turned out beautifully. Even though Chapter 12 warns that splits tend to be more equitable than theoretical predictions when you run experiments, the results of our in-class experiment were remarkably close to the theoretical predictions, and the students grasped what was going on very well (as far as I could gather from the ensuing in-class discussion after we tallied the results, and the following problem set).

• Chapter 22. Markets and Information
• For this lecture we used a custom Perl/CGI script that allowed students to trade in shares that represented the day they believed the take-home final would be given out (I had neglected to specify a date on the syllabus, and so this presented an opportunity to wager on an outcome). There were considerations such as day of the week (would an instructor release an exam on the weekend (23rd or 24th)), proximity to when the exam was due, allowing for a sufficient study period during which students could still ask questions about the course material, etc., and we discussed each of these, including polling the class for preferences and opinions during the course of the lecture, so that more "information" could be captured by the market.
• To begin with, each student was given \$20 in cash, and 10 shares of each day. At the end of the lecture, only one day (the day the instructor selected as the day the final would be given out), would pay \$1 per share, all the others would pay \$0. Two students with the most money following the payout could select 2 problems on the following problem set that they could skip and receive full credit for. This incentive seemed to be more effective than extra credit points.

Below is a snapshot of user allocations for 3 sample students (I've removed the usernames, but in the actual interface, all students holdings are viewable, as well as a list of buy and sell offers, e.g. "user3 to sell 2 of April 24 for .2"

• user cash April 20 April 21 April 22 April 23 April 24 April 25th
user 1 start 20 10 10 10 10 10 10
user 2 final allocation 40.7 12 15 0 0 0 0
user 3 final allocation 13.285 23 7 4 35 0 27
• It was a simple script that did not use authentication, and fortunately students did not attempt trade in shares that weren't theirs. When they wanted to make a trade, they would specify their uniqname, the amount, the price, and whether it was a buy or sell order. The script would check whether they had sufficient funds or shares for the transaction, and would use a matching mechanism to match against previously submitted orders, in price, followed by time priority.

quantity:
price:

Day Market Price
April 20 1
April 21 .5
April 22 .19
April 23 .1
April 24 .2
April 25 .1

This activity was so engrossing to the students that I had a hard time getting the class to answer any questions that were not directly related to the question of the information market. Instead, they spent the entire time staring at their computer screens and clicking away. The final market prediction was that the exam would be released on April 20th ( the shares were trading at \$1). Even though I had actually decided to release it on the 22nd (something the market had undervalued), the prediction of the 20th was consistent with the information gathered from the students in class, and I rewarded 2 additional students who would have highest earnings given that outcome as well.

• Chapter 7. Evolutionary Game Theory
• Evolutionary game theory is beautiful captured by an agent based model, because you can actually set up little creatures that play different strategies, receive corresponding payoffs and reproduce if they are doing well enough.
•  In this pure strategy simulation, we present the students with a few default payoff matricies (virus, hawk-dove, hunter, mod-hunter), corresponding to games discussed in the chapter. They can also experiment with arbitrary symmetric payoff matricies by setting the payoffs themselves. The students can then set the intial populations and let the simulation run, observing which strategy "S" or "T", if either, is evolutionarily stable. In this model of evolutionary mixed games, individuals can play "S" or "T" with some probability p (which is their attribute), here, individuals reproduce/die off depending on their accumulated riches. Their offspring copy their p, but mutate it slightly. Over time, the population should converge to the evolutionarily stable strategy (results may vary though...). Again, there are some preset payoff matrices, or the payoff matrix can be set by the student.

• Chapter 21. Epidemics
• For this chapter I could draw on interactive demos I had developed for networks courses I had taught in the past. Not only do these agent based models illustrate concepts of epidemic spread, but they bring the network structural models to life (the parameters of the small world model affect whether an SIS infection persists in the network, while selecting between random and preferential attachment influences the rate of spread in an SI model).
•  Take a growing network, with and without preferential attachment. See how the tendency of new nodes to attach to well connected nodes influences the rate of spread: Diffusion in randomly and preferentially grown networks (NetLogo) Find out how random rewiring affects the probability that an infection persists in the network using an SIS (susceptible-infected-susceptible) model. Diffusion in a small world (NetLogo) Find out how community structure can affect opinion formation. Opinion formation on a toy network (NetLogo) Sometimes whether an opinion diffuses or not depends on the initial location where it is formed, and also whether one is dealing with simple contagion (each of your friends "infects" you with constant probability at each time point) or complex contagion (you need to hear it from at least two friends to adopt an opinion). This model is set up as a two-player game. Choose nodes in a small social network such that your opinion wins out. Simple and complex contagion (NetLogo)

• Chapter 13. The Structure of the Web
•  More interesting to students than the structure of the WWW was the structure of their own Facebook networks (and Web and social networks share some of the same characteristics). I had them follow the procedure written by Bernie Hogan in the NodeXL book, for exporting their Facebook networks into NodeXL, visualizing them, and computing various properties, including finding communities, individuals with high betweenness, etc., and explaining that in a subsequent assignment. This was in part an in-class activity because of the troubleshooting with NodeXL. These days undegrads have rather sizeable Facebook networks, but not always the fastest laptops, leading to a slow-running NodeXL. One workaround was to make NodeXL available via a virtual app server, but that created an additional layer of complexity with students having to get additional accounts. Gephi appears to be a good alternative (that runs on any platform, as opposed to just Windows), and may be simpler for students to use for the level of analysis used in the class.

• Chapter 14. Link Analysis and Web Search
•  One fun activity is to have class construct a single network collaboratively, while competing to have one student of their choosing receiving the highest PageRank, who then can distribute (or keep) some number of extra credit points. Each student is given two links that they can give to two other students. We used a Google doc where students could write their links (this lead to all sorts of data quality issues, because students would misspell each others names, etc.). If I were to do it again, I would write a script with a drop-down list of unique names that the students could select from. In any case, once the data is obtained, it is imported into some standard network analysis package, the PageRank is computed, and the winner announced. Unfortunately in this instance I had chosen to use NodeXL which at the time had a bug in its PageRank implementation (now fixed!) that rendered it unable to compute PageRank correctly when there are disconnected components in the graph. But on the left I'm showing the results of the same experiment done in an information retrieval class several years ago (where I used Guess to compute the PageRanks). The students came up with a clever piramid scheme that resulted in a relatively low indegree node of their choosing receiving the highest PageRank. This exercise does require time. If students are not given enough time to formulate strategies and then negotiate amongs themselves to implement them, likely they will revert to creating hubs (something that happened in my SI301 class exclusively, but not in the previous class), without giving more thought to "trapping" the random walker in their part of the network. Having high PageRank means that not only do others link to you, but those others are themselves linked to. I ask the students to experiment by varying the teleportation probability in applying PageRank to a small network, and also try and figure out why some nodes with equal in-degree have different PageRank values. PageRank on a small network (Guess)   This activity is a good precursor to the network formation exercise above.

• Chapter 19. Cascading Behavior in Networks
•  This NetLogo demonstration includes two networks from the chapter (Figures 19.3 and 19.4), a line network and my old Facebook network. The students can choose payoffs for adopting A (blue) or B (red), or the cost of adopting both (if the bilingual option is turned on). One can randomly allocate choices initially, or students can manually set the initial colors of nodes. The demonstration illustrates how cascades are bounded by clusters and also how nodes that are bilingual can actually impede the diffusion of new, superior technologies, i.e. where the green nodes are bilingual (they speak both red and blue)

• Chapter 18. Power Laws and Rich-Get-Richer Phenomena
•  This wasn't an in-class exercise but rather a task spread across a couple of assignments. Memes were the theme. In the first assignment, students were asked to visit the website KnowYourMeme.com, and deduce some common characteristics of popular memes. In a subsequent assignment they were asked to run the following simulation (which they were to code themselves, in retrospect, coding it for them would have saved a bunch of grief, but the computer scientists in the class enjoyed this one). There is a source message “abcdefghijklmnopqrstuvwxyz”. It gets copied in the following way: With 10% chance a person sees the source (that is, they hear the full message above), with 90% chance they see one of the derivative copies, chosen at random. When a copy is made, it is only partial. That is, the person copying often picks only a portion and repeats that portion. We could then discuss rich-get-richer phenomena and other attributes of memes, such as simplicity, as well as ways in which this very simple model does not capture true memetic spread.

• Chapter 4. Networks in Their Surrounding Contexts
•  This is a modification of the standard NetLogo implementation of Schelling's residential segregation model. Each point on the lattice can be occupied by an individual. Individuals move if the composition of their immediate neighborhood is not at least X% the same color as they are. Even when X is relatively low, e.g. 1/3, meaning that individuals are tolerant of living in diverse neighborhoods, the neighborhoods become segregated.

• Chapter 20. The Small-World Phenomenon
• Here I could draw on demos I had developed in past networks courses.
•  Experiment with the Watts-Strogatz small world model. See how different amounts of random rewiring affect the shortest path and clustering coefficient of the network: F The students can vary the probability that a link is formed as a function of lattice distance and observe the number of hops it takes a simply greedy algorithm to find its way from source to target. The setup can be computationally expensive -- the students should be warned to be patient and not attempt it on slow laptops

• Chapter 6. Games
•  The night before I was to give this lecture, I read "Classroom Games: A prisoner's dilemma", suggesting that "Playing cards are convenient for classroom games because they allow the instructor to implement the experiment quickly, even in large classes. Cards also permit students to keep their choices secret until asked to reveal them." So I brought along 2 decks of cards, asked each student to take one of each color, and played the following game, first pairing students off, and then having them play by row (there were about 5 rows of ~ 6 students/row). The payoffs are as follows: red card: you get \$1 no matter what anyone else plays black card: you get \$4 if everyone else in the group plays black and \$0 if at least one person plays red. The exercise, as designed, is supposed to first get the students familiar with playing games, thinking about strategies and payoffs, etc. Then it is supposed to demonstrate the difficulty of coordination in larger groups. In my class, the students openly communicated (wink-wink, go team) to get everyone in a row in line and playing black, making coordination more likely (since by that point they know how the game works), which caught me by surprise. A workaround might be to have the students select a strategy without revealing what the groupings are (e.g. it could be rows or columns or bithdays or some other attribute). Still, for the small amount of setup effort and the engagement of the students in the exercise, it was worthwhile.

• Chapter 23. Voting
•  I had prepared this exercise, but we had gotten so deeply into discussing the voting mechanisms that we did not get to try it out. Using R, I generated sequences of preferences among A,B,C,D,and E, where two of the choices were in close contention, and the rest were more likely to occupy the less favored spots.Each student would receive one post-it note with their preference. The students would be given for each letter information on how many times it was selected as 1st, 2nd, 3rd, etc. in the generated sequences. The winner among A,B,C,D, and E would be determined by a Borda count of votes submitted by students. However, students would not need to report their "true" preferences and could vote strategically instead. Their payoff would depend on their true preference however. If their true preference was C,D,E,A,B, then if A wins they got 1 point, if C wins they got 4 points, etc.

• There are also a couple of other demos I used in the introductory lecture & first few (1-5) chapters on networks:
•  Vary the average degree in the classic Erdos-Renyi random graph model. Is there a critical average degree at which a giant component emerges? Giant Component Model (model is part of the standard NetLogo models library) Start with a simple Erdos-Renyi random graph, and figure out how the density of the network affects the speed of diffusion. Diffusion in an Erdos Renyi graph (NetLogo) Each node that joins the network has to decide what other node(s) it will attach to. It can do this purely at random, or it may prefer nodes who have more connections. Vary this preference and see the effect on the growing network. Random and preferential attachment NetLogo model Use the Girvan-Newman betweenness clustering algorithm to discover community structure in the linking patterns of political blogs. Betweenness clustering using Guess Many real world networks are scale free. See how the Gnutella peer-to-peer filesharing network holds up to random node failure and targeted attack on the highest degree nodes. Testing the resilience of a Gnutella network (Guess)

I didn't have time to create all the demos I would have liked to (I was preparing another new course in parallel). For that, and other reasons, I'd love to hear what others have come up with, so if you have demos/activities for a similar class, please let me know: ladamic@umich.edu.