ForceDirectedLayout question

Hi,



I can’t let the ForceDirectedLayout take full advantage of the size of the view when a lot of nodes and links are displayed.

This is my method that I use:



private void DoForceDirectedLayout()

{

GoLayoutForceDirected layout = new GoLayoutForceDirected();

layout.Document = MyView.Document;

layout.MaxIterations = 500;

foreach (GoObject obj in MyView.Document)

{

GoLink link = obj as GoLink;

if (link != null)

link.AdjustingStyle = GoLinkAdjustingStyle.Calculate;

}



layout.PerformLayout();

MyView.RescaleToFit();

}



If I don’t set the MaxIterations the GoView is nicely filled when I display 97 nodes. When the MaxIterations is set to 500 then only half of the length of the view is used.

When I display 487 nodes, it uses only 1/20the of the length of the view. It seems that the Y-as isn’t taken in account when calculation the positions. This happens when MaxIterations is set or not set.

Is there an easy way to let the method takes full advantage of the View size?



Thanks.

Have you tried larger values of MaxIterations? Larger numbers of nodes need more time to settle down with ForceDirected.

A larger MaxIterations is not an option. Rendering 500 nodes already takes too much time, when I increase the interations it will only be slower.

I discovered that playing with the Electricalfield might be a solution.

But my boss and I decided to let the demo show no more than 200 nodes. So this problem is postponed for a later time. If new and improved algorithms are coming soon, please let me know.