September 26, 2009

Facebook Friends Graph — Plotting your social network together

Filed under: Blog — krkhan @ 3:58 pm

Update: New version

While visiting profile of a friend, I noticed that he and I had about 70 mutual friends. Immediately it gave me the idea to plot the common friend connections and see what interesting patterns emerge in the larger picture. Something like this:

Facebook Friends' Graph Sample

In the sample above, the names in circles (“nodes”) happen to be in my friend list. The connecting lines represent their own friendship status. For example, Saad Jasra and Hassan Ahmad are friends among themselves apart from being my friends on their own. Similarly, Ali Zeeshan Ijaz is a friend of both Saad Jasra and Abdullah Afaq Ali.

Luckily, Facebook API had Python bindings available which considerably simplified my task. Those, coupled with pydot, resulted in a dot file with all the required connections. Graphviz did the remaining work:

Facebook Friends' Graph
(Click on the thumbnail for larger version.)
(Warning: The larger version is a 7329x5953 PNG image with a humongous file size of 13 MB. If your hardware specs are squeamish, don’t blame me if it brings your machine on its knees — this is not a DoS attack.)

Now came the intriguing part. The resulting graph was visibly split in two large portions. This resulted from the fact that I had spent a major portion of my life (15 years to be exact) in Saudi Arabia before moving to Pakistan. More interestingly, an old friend of mine from Saudi Arabia — Atif Sheikh — was also enrolled at my university in Pakistan. When I zoomed into the graph, I spotted him at the nexus of two networks. Similarly, the names in the middle of a network were the most connected people in that network. That is, the names congested in the middle of Pakistan network were friends from university and the names at the edges of that network were friends outside the university who didn’t share my academic connections.

I haven’t polished the code for a stable release yet as I doubt that other people would be interested in having gigantic plots of their social lives. Nevertheless, I’ll try to package it in form of a proper Facebook application in near future. After all, as I quoted in a previous post of mine:

“Statistics are like a bikini. What they reveal is suggestive, but what they conceal is vital.”

Tags: , , , , , , , , , , , ,


  1. It would be great to have this as a Facebook app.! Nexus is a current facebook app. that does this (, but it’s shutting down in early October.

    Comment by Mike — October 2, 2009 @ 7:05 pm

  2. Thanks for link Mike. Since I can’t host this application on a server (the computing cost of graphs would be too heavy for me to manage), I will release it as a desktop app soon.

    Comment by krkhan — October 4, 2009 @ 12:34 pm

  3. I would love to use this application! Plz who ever makes an application for this do give the name or download link over here!

    Comment by Jehanzeb Malik — October 12, 2009 @ 10:03 pm

  4. […] Facebook Friends Graph — Plotting your social network together […]

    Pingback by Facebook Friends Graph v0.1 | Inspirated — November 21, 2009 @ 12:01 am

  5. visit Mybook
    and see the diference with facebook

    Comment by gillardg — March 17, 2010 @ 8:52 pm

  6. […] Inspirated Facebook Graph […]

    Pingback by Great resources « Jasonohler’s Blog — January 13, 2012 @ 9:28 am

RSS feed for comments on this post.

Sorry, the comment form is closed at this time.