Declutter layout algorithm

Hi all you algorithm gurus - I'm looking for ideas for an algorithm to solve the following problem. It's specifically meant to "spread out" or "declutter" the overlapping vertices in a graph visualization system, but I'll state it in more general terms.

In a rectangular area of the screen there are n rectangles. Each rectangle has a location (the (x,y) coordinate of upper-left corner) a width and a height. Some of the rectangles may overlap each other. The declutter layout algorithm should translate the vertices from their original locations, such that after translation no vertices overlap. The algorithm should also try to minimize the translation distance of each rectangle, so the user does not lose all context.

Any ideas? Sounds similar to a spring embedded layout algorithm, or some kind of repellent force algorithm, except we're not concerned about connectedness of vertices. Just need to spread out the overlapping ones.

[959 byte] By [zcox522a] at [2007-10-2 10:29:05]
# 1

> Any ideas? Sounds similar to a spring embedded

> layout algorithm, or some kind of repellent force

> algorithm, except we're not concerned about

> connectedness of vertices. Just need to spread out

> the overlapping ones.

I think a good way to start thinking of algorithms is to consider how you would do this manually. In this case, I would probably start at the top left-corner rectangle, find elements overlap it, and move those away in along the axis of their greatest linear overlap. Then recurse on those rectangles.

Now if the relative position of the elements is unimportant, you can use a bin packing algorithm and rerrange all the elements.

dubwaia at 2007-7-13 2:10:57 > top of Java-index,Other Topics,Algorithms...