Mapping Social Networks (with APIs)

There seem to be many reasons why people connect online. For example, on Twitter, I have connected to friends, colleagues, family, people I have met at conferences (or simply know from some of the work), and a couple celebrities (like Tom Waits). These few reasons encompass a largely incomplete list of why two people may connect on a social network; of course, understanding why people connect to each other would give insight into suggesting new connections for people to make… This is all part of ongoing work. However, one of the things I was interested in doing with this is looking at how connections relate to locations: I wanted to visualise the extent that overlaying a social network over a map would demonstrate some (any?) kind of clustering/ whether any groups may emerge. Fortunately, there are a ton of APIs out there, ready to be played with (perhaps Berners-Lee’s “raw data now!” chant is indeed coming true). I tried out a couple:

Twitter REST API: for collecting social connectivity info (it helps being whitelisted if you woud want to collect a lot of data, otherwise 100 hits/hour should be enough!)

Yahoo! GeoPlanet API: the neat thing about this API is that it takes a user-input description of a location (“Barcelona, Spain”) and returns a detailed description of the location, include latitude/longitude (41.385658, 2.16994). This API allows 50,000 queries per day, and requires an App ID.

Google Maps API: for putting markers on a map. Probably includes some of the same functionality that GeoPlanet provides, but I ran into and started playing with GeoPlanet first, thanks to this blog post.

I toyed around with a small example, using people who I follow and who follow me on twitter. The whole process runs in three steps: (a) collect data from twitter, (b) process data and query GeoPlanet, and (c) map data to a Google map. I did the first two with some simple Java code, and the last bit with Javascript. Of course, I had to throw away some of my contacts, who did not input any location information (may be it’s possible to make a reasonable guess about their location based on who they connect to?). On the other hand, other users had input their iPhone coordinates, which didn’t require GeoPlanet at all and was very precise. The results, on a Europe-centric map, are here, and a screen shot is below. As I said above, this is part of ongoing work; so I’ll limit this post to reporting on these neat APIs and I won’t discuss the map I obtained. Do you have any thoughts/suggestions?

3 Responses to “Mapping Social Networks (with APIs)”

The google maps api does have the same functionality as yahoo. Is there the same location information in facebook or linkedin, enabling a comparative study? The hypothesis goes something like “a public REST interface increases geographical diversity”.
cheers
ian

Interesting idea! At first glance, both LinkedIn’s and Facebook’s APIs seem to be more application-oriented. For example, the LinkedIn API only allows you to get first-degree connections (I assume that means the connections of the authenticating user):