Constructing a Social Graph With Twitter and Plotly

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 Tech Powered Math 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.

Related articles:

Lucas Allen

Lucas Allen

For more than a decade, Lucas Allen was a high school math teacher and math team coach in Illinois. His 2012 Morton High School math team won the Illinois state championship. Recently, he made the jump from public education to the corporate world and is now working as a data scientist. He is interested in just about all forms of technology, including the TI-Nspire, Nexus devices, R, MOOCs, and more. You can follow , and if you are nice, he will probably follow you back.

More Posts - Website

Follow Me:
TwitterFacebookGoogle Plus


Sorry, comments are closed for this post.