Menu

having different edge labels for each edge

Anonymous
2012-05-04
2013-05-29
  • Anonymous

    Anonymous - 2012-05-04

    Hi,

    I want to put the time of an event between 2 edges. The time can differ or be the same for any 2 edges. How to do this?

    Thanks,

    Gargi

     
  • Joshua O'Madadhain

    You can assign a label to each edge which need not be the edge object's toString() output (that's just one of the more popular options).  See PluggableRendererContext for details.

    Joshua

     
  • Anonymous

    Anonymous - 2012-05-04

    hi,

    I am using the tostringLabeller() method for now.
    I have added the time as a label and it is throwing an exception for the edges where the times are the same.

    Is there a better way to do the same thing?

    Can you share an example?

    Thank you,

    Gargi

     
  • Joshua O'Madadhain

    Gargi:

    (1) The edge objects must be unique (in the sense of having different hash codes and not comparing as equals with one another).  Think of them as elements of a Set.

    (2) There are several different ways to associate user data (such as labels) with graph elements (vertices and edges).  Properties of the edge objects are just one way to do that.  See http://code.google.com/p/jung/wiki/Manual#User_Data_and_Function for a discussion of this (note that you should be using Transformer instead of Function, but the rest of the discussion is accurate).

    (3) If you do want to use properties of the edge object, the equals()/hashCode() methods need not be functions of the label property.

    Joshua

     

Log in to post a comment.