Skip to content

Conversation

@chubakueno
Copy link
Contributor

@chubakueno chubakueno commented Jun 10, 2025

Purpose

Adapt layout algorithm for both input and output. Output nodes will always relayout to the right when confirmed, but further manual relayouts may wrap them around if it sees so fit by the Sugiyama algorithm.

Input:

2025-06-09.15-59-18.mp4

Output (showing effects of then doing a manual Ctrl+L relayout):

2025-06-13.16-05-49.mp4

Declarations

Check these if you believe they are true

  • Is documented according to the standards
  • The level of testing this PR includes is appropriate
  • User facing strings, if any, are extracted into *.resx files
  • Snapshot of UI changes, if any.
  • Changes to the API follow Semantic Versioning and are documented in the API Changes document.
  • This PR modifies some build requirements and the readme is updated
  • This PR contains no files larger than 50 MB
  • This PR introduces new feature code involve network connecting and is tested with no-network mode.

Release Notes

Adapt layout algorithm for both input and output.

Reviewers

@johnpierson
@BogdanZavu

FYIs

(FILL ME IN, Optional) Names of anyone else you wish to be notified of

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the ticket for this pull request: https://jira.autodesk.com/browse/DYN-8905

@johnpierson
Copy link
Member

The first image looks great! I think that is ready to go for input ports. The second image; we would really like the nodes to be over to the right. We don't want them to wrap around like that. So I think it is a matter of setting the offset to be bigger?

@johnpierson johnpierson requested a review from Copilot June 10, 2025 17:03

This comment was marked as outdated.

@johnpierson johnpierson added the ai/ml 🧠 synapse team related PRs label Jun 10, 2025
@johnpierson johnpierson requested a review from Copilot June 16, 2025 13:06
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adapts the layout algorithm to handle both input and output nodes by changing method signatures and adjusting node positions accordingly. Key changes include updating parameters from booleans (e.g., reuseUndoGroup) to a PortType value, initializing new node position properties, and extending the layout algorithm to account for output node adjustments.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/NodeAutoCompleteViewExtension/ViewModels/NodeAutoCompleteBarViewModel.cs Updated method call arguments to use PortViewModel.PortType instead of a boolean flag.
src/Engine/GraphLayout/GraphLayout.cs Added new InitialX property and initialized it in the constructor.
src/DynamoCoreWpf/ViewModels/Search/NodeSearchElementViewModel.cs Updated node auto layout call by replacing a boolean parameter with portModel.PortType.
src/DynamoCoreWpf/Utilities/NodeAutoCompleteUtilities.cs Modified parameters and documentation to reflect using PortType in place of a boolean.
src/DynamoCore/Graph/Workspaces/LayoutExtensions.cs Extended auto layout methods for autocomplete to support port type adjustments and introduced anchor-based overlap avoidance.
Comments suppressed due to low confidence (1)

src/DynamoCore/Graph/Workspaces/LayoutExtensions.cs:114

  • [nitpick] Consider adding inline documentation here to explain the rationale behind computing 'minX', 'targetMinX', and 'displacement' when 'portType' is Output, as this would improve maintainability and aid future debugging.
if (portType == PortType.Output)

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Member

@johnpierson johnpierson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks pretty good, but the input layouts still feel off to me.

20250617-dnaLayout

/// <param name="newNodes"></param>
/// <param name="misplacedNodes"></param>
/// <param name="portType"></param>
internal static List<GraphLayout.Graph> DoGraphAutoLayoutAutocomplete(this WorkspaceModel workspace,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not so sure about having a different layout function for autocomplete. Ideally it should be the same - if changes are made to regular autolayout then we'll need to make adaptations to autocomplete also. But if we really have to do it then we'll do it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a direct consequence of the above placing a single node from the new experience should result in the same layout arrangement as when placing the same node node from the old experience.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Separated both because otherwise they get too many interspersed ifs. Ultimately i also feel more safe making adjustments to the cluster layout algorithms that i know wont modify the the manual layout algorithm and vice versa. Both are similar in behavior but also have important differences. Both decide differently which updates to save, what nodes to consider (by selected or by transient), etc.

https://www.diffchecker.com/fU2sRLYc/

@chubakueno
Copy link
Contributor Author

chubakueno commented Jun 24, 2025

this looks pretty good, but the input layouts still feel off to me.

20250617-dnaLayout

Hm. once you add the third element it has overlapping nodes because the "pushing" algorithm will only run once. This is intended to not move the rest of the graph too much. We could make it run more times but we should keep that in mind.

@johnpierson johnpierson merged commit 6de8441 into DynamoDS:master Jun 25, 2025
26 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai/ml 🧠 synapse team related PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants