views:

176

answers:

2

I use Jung to draw graphs. Below is a simple graph with tree layout that looks fine. All renderers and transformers are default.

alt text

Now, I have changed the default size of the nodes to 100px by setting a custom VertexShapeTransformer. The problem is that the nodes started to overlap. Here you can see how it looks:

alt text

Is it possible to get rid of the vertex overlapping? Is it a matter of layout or some kind of shape transformation?

Thank you in advance for any suggestions :-)

A: 

Perhaps you need to put a greater distance between the nodes? You started with a certain distance with a certain size nodes. When you increased the size of the node you reduced the space between them, to compensate extra distance needs to be put between the nodes to keep them from overlapping.

mjboggess
I do not know nothing about graph layout algorithms, but should not they consider the node size?
czuk
A: 

After not so long investigation I found out that there are two static attributes responsible for setting the minimum distances between vertexes. These are TreeLayout.DEFAULT_DISTX and TreeLayout.DEFAULT_DISTY. Unfortunately, those attributes define a fixed minimum distance between vertexes but do not consider the real size of each vertex that may differ. The setting is valid for the TreeLayout and the BalloonLayout that extends the TreeLayout.

I also tries other layout but I could not find an analogical solution. This issue is for another question ;-)

czuk