Constructing a Social Graph With Twitter and Plotly

Constructing a Social Graph With Twitter and Plotly

By Lucas | January 6, 2016

In a couple of earlier posts, I showed an example of a social graph created from Twitter data and Plotly, a graph of relationships between educational technology enthusiasts on Twitter. Those posts were more for the educator audience that I write for, but increasingly, I’m getting feedback on my posts from other data scientists, so I’ve decided to include my code, both here on this blog and at my Github account. If I end up making changes to this code, I’ll try to update it on Github, but I may be slower to do so here on the blog.

I’ve included the code in two iPython Notebooks. The first collects retrieves the data in a couple of stages from Twitter. Simply put, collect Tweets from a community of users with an identifying characteristic (in this case, a chat hashtag they all use). Then, collect all of the friends of those users in order to find relationships between them.

The second notebook is creates a nice interactive visualization of the data collected from the first notebook using Plotly. Of course, depending on your use case, Plotly may not be the best tool. Gephi may be far better for quick and easy analysis from your local machine. However, I wanted to do an example that I could share on the web.

I also envisioned the possibility of high school teachers reproducing this experiment with their students. Directing students to a Plotly page that had been pre-rendered is certainly easier than installing Gephi on many machines in a lab if your district IT person is not cooperative, which is the case in some school districts.

comments powered by Disqus