Monday, February 25, 2008

Real life Social Network with JUNG

A while ago I wrote about an application I made with the help of the JUNG library. Since then I've played a bit more with the library (the V2 release) and came up with another even nicer app.
The application is a window to the LinkedIn social network graph which is the largest professional social network in the world.

There is a lot I can write on the application, but its hard to describe it without seeing it. Here is a short summary.
The application is a bit different then the common social network application. The application facilitates a real time, ongoing moving window to the graph. It constantly reveals and removed vertexes (people) to/from the graph with a delay of few seconds between the events.

The visual graph keeps on drifting from the left hand side of the display (full screen mode) to the right hand side. A vertex arriving to the right side of the display disappears.
The application keeps an in memory "shadow graph" which enables it to immediately show all the inner connections between the people in the visual graph.
The graph layout is a modified version of the JUNG Spring layout. The since a person is being displayed for at least few minuted before disappearing on the other side of the graph, there is enough time for the spring layout to cluster together groups of persons.

Each person in the graph is described by her country flag along with a label which describes something about her like company she works at and the position she is in. A connection between two persons has an attached label with the date of when the connection was created.
The application has no names and makes an effort to remove personal information like names and display only statistical information.

The application is displayed only within LinkedIn on one of our huge plasma screens in the building. If one wish to see JUNG in action, drop me a note (we're located in Mountain View, California).

For the ones who are more interested in the library itself, here is a summary of some of the artifacts I used / modified:

  • Created a new DynamicRelaxer extending VisRunner: I had to play with the stepInTime method since I wanted to accelerate the group formation right after adding a new node to the graph and slow the Spring Layout when the formation has been created.
  • Extended the SpringLayout: After a while the step() method started to throw exceptions due to inconsistency in the data structure. The exceptions would stop the graph, so I wrapped it with try/catch and enabled it to keep going (the application should run for months).
    • In addition I overrided the getSpringData method to control the way the vertexes in the graph would drift out of the display. The method determines the speed of a node using the time it entered the display and how well it is connected in the graph.
  • New EdgePaintTransformer which color edges of islands in the graph with the same color (to visually distinct between disconnected parts of the graph).
  • New VertexLabelRenderer which created a description from the person's information and returns a cached panel with a set of JLables.
  • New LocationTransformer to define the place where new vertexes appear on the graph (right hand side).
  • Created a new IconTransformer which changes the icon of a vertex after the first few seconds it is displayed.
  • New EdgeLabelRenderer to show metadata from the DB about the connection.
I wish to complement again the JUNG team for the great library. There are few problems with multi-threading which I'm trying to figure out, but I'm not sure its all JUNG's fault. Again, if you're interested in actually seeing the application, come over.
By the way, we are heiring, so bringing with you a CV might bee a good idea :-)

For all of you who are interested in JUNG, you are welcome to join the JUNG LinkedIn group.


Creative Commons License This work by Eishay Smith is licensed under a Creative Commons Attribution 3.0 Unported License.