views:

678

answers:

2

I am currently writing a control (in C#) for displaying a set of tables and the relationships that exist between them. I got the basic control done, but would like to implement something similar to the "Auto-Arrange" feature provided by the diagramming component of SQL Express.

What kind of algorithm does it follow to identify the optimal layout of tables? That is, an algorithm that considers all the "relationship paths" and comes up with a layout in which the tables can be arranged without much clutter.

Thanks.

A: 

Check out graph layout algorithms, in particular "orthogonal layout". According to Wikipedia this is a "layout with edges running horizontally or vertically, with approaches that reduce the number of edge crossovers and area covered."

Adamski
+1  A: 

Look into Graphviz. Even if you can't use it as a dependency, it has plenty of documentation about the algorithms used.

Ants Aasma