erik (elo_sf) wrote in lj_nifty,

  • Mood:
  • Music:

Perl LJ Friends Graphing

Many of you may recall the old "dot" files generated by the server for use with the "dot" utility (part of Graphviz package from AT&T to generate nice inter-connection graphs with a user and their friends.

I had always "hacked" with the dot files to make the graphs more interesting. However, almost a year ago, the "dot" files were removed from the servers and no graphs were forthcoming. I finally got around to using the robot friendly friends data (info) to build a dot file generator in perl.

Dependencies: perl, graphviz dot program, and several fairly common Perl modules (Cache::FileCache, Data::Dumper, Digest::MD5, and LWP::UserAgent).

I made a conscious decision not to show the "active" user in the graph, but rather to focus on the inter-relationships between my friends.

More specifically, taking a look at my own graph:

elo_sf -

Each node is someone who (i) I friended, (ii) who friended me, or (iii) both. An arrow between two nodes, e.g. sidewinder and jakejr, reflects whether one or both of them lists the other as friends.

When running the command, a user's livejournal password can be specified, in which case the nodes are colored based on the user's livejournal friends colors.

Download Script

EDITED 2004-08-30: Fixed URL so no password, sorry.

EDITED 2004-08-30 #2: Note, some of the "system" calls in the Main function are specific to my machine/OS X. Line 63 has a system command that points to the path of the "Verdana" truetype font on my machine. Line 64 sets the filetype on OS X and Line 67 opens the resulting image on OS X. 64 and 67 can just be deleted on non-OS X machines. Line 63 can be modified to point to your Verdana.ttf path -or- changed and then you can delete the reference to Verdana at line 141.
  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

← Ctrl ← Alt
Ctrl → Alt →
← Ctrl ← Alt
Ctrl → Alt →