Exploring your social media networks with Graphing tools such as Gephi is quite easy, the hardest part is working out what you want to explore and how you will get the data. As a starting point I’ve collected a few simple recipes for network graphs. I’ve done all these on a ‘nix based system, but it should be roughly the same to do it on Windows (but leave a comment if it isn’t and I’ll work out why)
Graph the connections between your Twitter friends
This can actually be quite a difficult thing to do due the limit on the Twitter API and if you want to do it yourself then it is easier the fewer friends you have. If you have a large amount of friends then you might be best looking for a service to do it for you unless you can wait a long time to grab the data within the Twitter API limits.
1. Grab twecoll
I’ll be using a tool called Twecoll to download information about connections between the people I follow. an Download twecoll from it’s Github repository by heading over to https://github.com/jdevoo/twecoll and clicking ‘Download Zip’
2. Create a Twitter App and grab the API keys
Before you can use the Twitter API you need to have a Twitter account and a mobile phone number associated with that account If you haven’t already associated a mobile phone number with your Twitter account you will need to before you can create a application, you can do that by logging in at https://twitter.com/settings/devices
Once you have added a phone number to your account you need to head over to https://apps.twitter.com/ while signed in and create an app, the reason for doing so is that you will need to get access to the Twitter API for twecoll to work. Create an application and fill in the values with anything you want, you can leave the callback url option blank, once you have created the application look for the link that says ‘manage keys and access tokens’. On this page you should see a Consumer Key and a Consumer Secret, these are what twecoll needs to access the Twitter API and they need to be saved in a secret file. You can do create the file in Terminal with the lines:
cd ~ sudo nano .twecoll
Paste your keys in to terminal, the consumer key on the first line and the secret on the second line and save the file (ctrl x).
3. Grab the data using twecoll
Extract twecoll from the zip file and change directory in to the directory where twecoll resides and run the command that will generate a file with information about your Twitter account
cd twecoll-master ./twecoll init <username>
You then need to work out who is ‘friends of friends’ this is done by using the command. This might take a long time, when the API limit is reached the script waits for 15 minutes before carrying on. Users following thousands of will be skipped due to the limits.
./twecoll fetch <username>
Finally we can create an edgelist:
./twecoll edgelist <username>
You might get a a few warnings for ‘missing data’. These are instances when twecoll skipped users due to the API limit. If you have igraph installed then it will attempt to create a visualisation for you.
4. Visualise it yourself
Head over to the Gephi homepage and download the latest version. Once you’ve opened the program you will be invited to open a graph file. Navigate to your twecoll directory and open the GML file that was generated by the last command that we ran. It should display your nodes and edge.
You can then resize the nodes and edges as you wish. Each node on the graph represents a person while the edges represent a following one way or another between them. There are lots of tutorials to do that on the web, here is mine for twitter handle @paddytherabbit, For color I’ve used something called the Louvain modularity method which basically detects communities in the graph , each node has been sized according to a measure called Betweeness Centrality.
How to video: