Social network analysis in Facebook

From time to time I like to dabble in social network analysis. Now that Facebook has opened itself up to programmatic access, I thought I’d do some spelunking to see what I could learn. Here are a couple of questions I’d like to answer about the “clubbiness” of tech-company Facebookers:

1. Looking at the tech-company population as a whole, do people socialize within and across corporate networks more than elsewhere?

2. Looking at individual tech companies, which are more or less likely to mingle with other tech companies?

The questions are certainly answerable. Surfing around in Facebook, for example, I can view the profiles of my friends at Microsoft and elsewhere, and find out to what extent they, and their friends, socialize with people in their home corporate networks, with people in other corporate networks, and with people elsewhere. Since Facebook is a web application, the same information is — by definition — available by means of screenscraping, if you want to go to the trouble, which I don’t.

So far as I can see, though, you can’t automate this process using the Facebook API. A Facebook application can enumerate the friends of the logged-in user, but not those friends’ friends. It’s hardly surprising. There’s plenty of risk in allowing that kind of transitive data-mining, and no obvious benefit to Facebook.

I guess the Facebook way of doing this kind of analysis would be to create an application that goes viral, and pools information from the perspective of many different Facebookers. I’m unlikely to do that, but if it’s something you’re considering, here are a few points to consider.

First, in order to avoid the server meltdown problem that Marc Andreessen discusses in his analysis of the Facebook platform, it might be interesting to do a desktop application. I hadn’t known such a thing existed, but I wrote a little one today, using the Python bindings to the Facebook API. In this scenario, client-side code invokes the browser to do an interactive login, and then makes API calls into Facebook. The advantage is that if your application gets more popular than you could support with a service in the cloud, it’s no problem, because users download it and run it locally. The disadvantage, of course, is that they have to download it and run it locally. And especially for an application like this one, which intentionally crosses cultural boundaries, you’d have to be prepared to run on any client OS.

Second, it looks as though, in one respect, the Facebook API doesn’t quite work as advertised. My desktop application should at least be able to report how many of my own friends are in the Microsoft network. But while the documentation says I can query for all of my friends’ affiliations, I’m only seeing one affiliation per friend. So if a Microsoft friend’s primary affiliation is the Seattle network, my application doesn’t know that he’s a Microsoft friend. Am I right in regarding that as either a software or documentation bug?


  1. I have long wanted to do this, and have written an application that could technically do it. However, it would be against the terms of the Facebook API:

    Returns the identifiers of the current user’s Facebook friends. The current user is determined from the session_key parameter. **The values returned from this call are not storable.** (emphasis added)

    I haven’t done any work with affiliations, but looking at the documentation if there aren’t multiple affiliation elements under the affiliations element, it’s a bug. Check your code?

  2. “looking at the documentation if there aren’t multiple affiliation elements under the affiliations element, it’s a bug. Check your code?”

    Turns out to be a PyFacebook problem. The JSON rendering works properly, but the XML rendering truncates. I reported it.

  3. Does Facebook allow you to do “snowball sampling” — i.e start with your node and then get friends, FOAFs, etc.? LinkedIn allows you to get all of your friends, but not FOAFs. Without knowing how your friends are connected, and who your FOAFs are and how they are connected, it is hard to read much into your social graph.

    Here is a quick social graph I did from my RYZE data [remember them???] when they allowed access to FOAFs…

  4. Hi,

    I am wondering about one thing on Facebook. From time to time, it comes to my attention that a friend of mine and another friend of mine know each other, which i didn’t know before. Then i go and ask to one of them, how do you know the other guy?

    Is there a way or application to find things like this?

  5. Hi,

    I’m a student of IIIT Delhi and I’m doing research on how geographic distance affects communication on Facebook.

    I’m writing an app to automate data collection and I would be extremely grateful if you could let me have a look at your code so I can figure out how to make it work for me.
    Raghav Sethi

Leave a Reply

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

You are commenting using your 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