void CreateInitialOrderInLayers() { //the idea is to topologically ordering all nodes horizontally, by using vertical components, then fill the layers according to this order Dictionary <int, int> nodesToVerticalComponentsRoots = CreateVerticalComponents(); IEnumerable <IntPair> liftedLeftRightRelations = LiftLeftRightRelationsToComponentRoots(nodesToVerticalComponentsRoots).ToArray(); int[] orderOfVerticalComponentRoots = TopologicalSort.GetOrderOnEdges(liftedLeftRightRelations); FillLayersWithVerticalComponentsOrder(orderOfVerticalComponentRoots, nodesToVerticalComponentsRoots); LayerArrays.UpdateXFromLayers(); }