Hi,
Here is some code you could play with:
Diagram diag = new Diagram();
diag.ValidityChecks = false;
diag.DefaultShape = Shapes.Rectangle;
DateTime start = DateTime.Now;
for (int i = 0; i < 50000; ++i)
diag.Factory.CreateShapeNode(10, i*40, 30, 30);
MessageBox.Show("nodes created for: " + (DateTime.Now - start).ToString());
start = DateTime.Now;
for (int i = 1; i < 50000; ++i)
diag.Factory.CreateDiagramLink(diag.Nodes[i], diag.Nodes[i / 1000]);
MessageBox.Show("links created for: " + (DateTime.Now - start).ToString());
diagramView1.Diagram = diag;
Creating the 50000 nodes takes about 5 seconds on my system, and creating the 50000 links takes 15 seconds.
It's important that the diagram is not attached to a view while creating the items, or otherwise that would trigger many repaint events and slow down the Create calls a lot.
Note that creation time depends much on the structure of the graph. E.g. in my test if all 50000 links were connected to diag.Nodes[0], it took about two minutes. Seems it's a lot faster to update the link collections of size up to 1000 links for 50 nodes, than updating a single node's links collection with a size of 50000 links.
You might consider delay-loading your items, e.g. by showing only the first two levels of your hierarchy as Expandable nodes, and then create additional child nodes in response to the ExpandBtnClicked event.
I hope that helps,
Stoyan