Quote:CompositeLayout which creates about 700 partitions
This kind of defeats the purpose of using composite layout, which is to run the polynomial-complexity layout algorithms on smaller graphs, and here the master graph is on the large side. Generally you'd want both the inner and outer graphs to be as small as possible, so partitions close to the sqrt of all items, e.g. 30 partitions x 30 nodes for diagram with 900 nodes. Anyway I've tested the sample project with some time measurements and MasterLayout replaced with SpringLayout instance -
async private void layoutButton_Click(object sender, RoutedEventArgs e)
{
var start = DateTime.Now;
// Reset styles
foreach (DiagramNode node in diagram.Nodes)
{
node.ClearValue(ShapeNode.BrushProperty);
node.ClearValue(ShapeNode.StrokeProperty);
}
foreach (DiagramLink link in diagram.Links)
{
link.ClearValue(DiagramLink.BrushProperty);
link.ClearValue(DiagramLink.StrokeProperty);
}
await ArrangeOnce();
diagram.ResizeToFitItems(5);
border2.BorderBrush = Brushes.Transparent;
border3.BorderBrush = Brushes.Red;
MessageBox.Show((DateTime.Now - start).ToString());
}
async private Task<bool> ArrangeOnce()
{
...
var masterLayout = new SpringLayout();
//masterLayout.CrossingLinksCost = 0;
masterLayout.LayoutNode = OnMasterLayoutNode;
masterLayout.LayoutLink = OnMasterLayoutLink;
layout.MasterLayout = masterLayout;
...
return await layout.ArrangeAsync(diagram);
}
A 32-bit build with non-async code completed successfully in 12 seconds for 500 partitions by 2 nodes and in 1 second for 31 partitions by 33 nodes. Async code takes about double that time, I guess overhead comes from the more frequent visual tree updates happenning in LayoutNode / LayoutLink handlers. Still that's far from your 10 minutes - I guess check if some specific SpringLayout properties you are using aren't leading to that, or some slower code in LayoutNode / LayoutLink event handlers.
In release history I can see an "ArrangeAsync method of CompositeLayout now also applies MasterLayout asynchronously" item for v3.5.3, so also check if you aren't on older version than that. I've tried with current 3.6.3 assemblies.
Regards,
Slavcho
Mindfusion