Twitter # Diagrams

January 22, 2012

I recently wrote a humble piece of code that helps me see what a particular topic relates to. It uses Twitter as a source of data, simply searching Twitter for a hashtag and extracting all hashtags that are mentioned in the tweets returned. It then creates a graph representing the network of those tags.

Here is the resulting diagram for #google query with 500 results, tags mentioned under 15 times are omitted:
Every node of the graph is a hashtag, and every hashtag in the same tweet is connected with edges.

And here is the diagram for #sopa, 500 results, <20 omitted:

The parameters are as follows,

– The hashtag that will be queried.

– An integer value which excludes hashtags that are mentioned less than the given number. It simplifies the graph and removes the noise from output, especially if you are querying for a popular topic that is frequently spammed or if you are querying for thousands of tweets.

#wikipedia, 500 results, this time with a low threshold, tags mentioned under 5 times are omitted:

– The number of requested search results.

– The size of each node in graph is determined by the total number of times the hashtag it represents is mentioned. Characteristics of resulting list varies dramatically per query, so there are also parameters that can change the variety factor of node size in the graph output.

There are some other parameters which are neither interesting nor really important.

I mainly used
SBCL, a popular Common Lisp implementation.
cl-twitter, an interface to Twitter API for CL.
s-dot, an S-Expression syntax for GraphViz Dot language.
cl-ppcre. a regular expression library for CL.

Thanks to respective developers, all are open source and available at links above. (There are other preferred ways of obtaining latest sources, though.) If anyone is interested in source that generates the diagrams, just let me know. I am hoping to make a simple CL tutorial out of it soon.

Advertisements

2 Responses to “Twitter # Diagrams”

  1. Raimon Grau Says:

    Nice!

    A tutorial out of this would be definately apreciated or, at least, a link to the code 🙂

    Good luck with your new blog!

  2. kenanbolukbasi Says:

    Thanks! I’ll make some modifications to code first, then I’ll write a tutorial and put the source to github, hopefully.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: