public void ApplyLayout(LayoutGraph graph) { var rows = graph.GetNodeArray(); // sort the rows by their vertical coordinate Array.Sort(rows, (node1, node2) => (int)(graph.GetCenterY(node1) - graph.GetCenterY(node2))); // layout the nodes in a column double currentY = 0; foreach (var node in rows) { graph.SetLocation(node, 0, currentY); currentY += graph.GetHeight(node) + Distance; } // there should be no edges between the 'row' nodes but if there are some, all their bends shall be removed foreach (var edge in graph.Edges) { graph.SetPoints(edge, new YList()); } }