Dynamo.Graph.Workspaces.WorkspaceModel.RunLayoutSubgraph C# (CSharp) Method

RunLayoutSubgraph() private method

This function calls the graph layout algorithm methods.
private RunLayoutSubgraph ( GraphLayout graph, bool isGroupLayout ) : void
graph GraphLayout The subgraph to be processed.
isGroupLayout bool True if all selected models are groups.
return void
        private void RunLayoutSubgraph(GraphLayout.Graph graph, bool isGroupLayout)
        {
            // Select relevant nodes
            graph.Nodes.ToList().ForEach(x => x.IsSelected = true);

            // Save subgraph position before running the layout
            graph.RecordInitialPosition();

            // Sugiyama algorithm steps
            graph.RemoveCycles();
            graph.AssignLayers();
            graph.OrderNodes();

            // Node and graph positioning
            graph.DistributeNodePosition();
            graph.SetGraphPosition(isGroupLayout);

            // Reset layer information and deselect nodes
            graph.ResetLayers();
            graph.Nodes.ToList().ForEach(x => x.IsSelected = false);
        }
WorkspaceModel