Dear all,

I am currently in the process of writing a custom portrayal class that can display JUNG graphs and I have a couple of questions.

First off, I realise that there is an example of how to do this linked on the MASON homepage, but that display class adds a lot of fluff that I do not need. For example, I will not need an algorithm to plan the graph layout, because all my nodes are already embedded in a 2D field before creating the graph. I use the graph only to store weighted connections between the nodes, and just need a portrayal class to draw those connections. As such this is very similar to how the native Network class works with NetwortPortrayal2D, but I would still like to use some of JUNG's features, like its shortes path algorithms. So what I'm trying to do is to write my own adaption of the NetwortPortrayal2D class that displays a JUNG Graph instead of a Network.

While digging through the NetwortPortrayal2D code I noticed something strange. I found this line in the hitOrDraw method:

if (edgemap.containsKey(edge)) continue;
                    edgemap.put(edge, edge);

I cannot for the live of me imagine why anyone would add an object to a HashMap as both key and value. Why not just use a set? Is this an oversight, or am I missing something crucial here?

Also, my graph is static and does not change at all during the simulation, so there would be no reason to redraw it at every time step. I found a flag called immutableField in the FieldPortrayal class, is setting this value to true enough to prevent redrawing? Or is there something else I need to do?

And finally, I would like to highlight certain edges during the simulation, e.g. the shortest path between two nodes for any pair of nodes selected by the user. What would be the easiest way to implement the highlighting? I'm not looking for a complete example, just some pointers to get me started. Can this be done without redrawing the entire graph?

Thanks in advance for any help.

Sincerely,
Miriam Tschanen