Question

I would like to visualise a graph (which is not a tree) in JUNG, using the tree layout. I understand that that may seem a bit odd, but the thing is the following. The application is backed by a Neo4J database. There are a bunch of nodes in them, all connected via several types of relationships. In other words, I have a cyclic graph.

If I imaginatively remove all the relationships except the ones with relationship type *IS_PARENT*, what I have left is a perfect tree. So there is a tree structure in my data, which JUNG can't see because of the other relations that make it cyclic.

There are 2 main reasons why I want to be doing this.

  1. Readability. There's a logic structure in my data, and I would very much like to visualise it.
  2. I have reason to believe that this will increase the performance of my application. At the moment the performance is very poor, due to the large amount of vertices & edges. I have also looked into another visualisation tool called Prefuse, and there I discovered that tree layout is a lot easier to deal with, at least that was the case in Prefuse and I'm hoping the same will be true for JUNG.

So there's a lot of benefit in it for me. I'm hoping someone here might be able to help me because I wasn't able to find something.

Was it helpful?

Solution

I found the solution. I decompiled the TreeLayout class, and simply changed the way it calculates the amount of children, and now it works like a charm. Only when using predicates, it remembers the old positions, and not the new ones...

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top