Teaching Graph Theory With Twitter

Teaching Graph Theory With Twitter

By Lucas | January 6, 2016

In a recent post, I displayed the social network graph that I created using the Twitter API and Plotly. There are a number of interesting applications here. Given my history with education, one that I think that shouldn’t be overlooked is as an interesting way to teach graph theory for an innovative teacher and school.

I taught graph theory myself for several years as part of a discrete mathematics course. While the textbook I used included many examples of “real world” problems that I found engaging, the students didn’t always agree. With an enthusiastic teacher and cooperative school, there is no reason that the experiment I did with #EdTechChat couldn’t be used to create a Twitter social graph of the students in a class or, better yet, a school. Seeing themselves, their classmates, and possibly teachers as a part of a Twitter graph is an engaging data set to explore.

Let me briefly describe the methodology for creating such a graph without the programming details. The Twitter API (Application Programming Interface), which is how Twitter allows the public to access their data via a programming interface, is used to search the Twitter timeline for a specific search term. In this case, I searched for #EdTechChat. In the case of a school, one could create a unique hashtag, say #MHSTwitterExperiment. All the usernames were pulled for the people that used that hashtag over a specific period of time. Then, again using the Twitter API, a search was done to see who those users follow, eventually restricting those results to only other users that had participated in the #EdTechChat.

From there, a visualization was created with Plotly that allowed viewers to interact with the data. I used followers and following, but of course, teachers of graph theory know that these are really proxies for indegree and outdegree. Betweenness centrality was also used to color the nodes as a rank of influence. Centrality wasn’t a term I used with my students when I taught graph theory, but it has become increasingly of interest in the field and is something beginning students of graph theory can understand.

Of course, there’s no reason that Plotly is a requirement for creating a visualization. In fact, teachers that have the ability to install free software can use [Gephi][2] and will have more options as to how they display and analyze the data gathered from the Twitter API.

The only catch with this whole process is that you do need to get the entire community to tweet the same hashtag at reasonably close to the same time unless you have another way to identify them. Having taught in the public school system for over a decade, I know that an enthusiastic teacher can definitely get kids on board with this kind of thing, but I am also realistic about potential obstacles (parents, administrators, skeptical colleagues).

All of the code to complete this task is readily available via my GitHub account, so really there’s no need for me if any code-savvy teachers decide to run with this. However, if there’s anyone out there that thinks this sounds exciting but feels like certain aspects of it sound intimidating, I would welcome the opportunity to lend a hand. Having been out of the classroom for a year now, I’m hoping to occasionally find some opportunities to make my new career and previous career intersect.

comments powered by Disqus