-
-
Notifications
You must be signed in to change notification settings - Fork 142
Loop edge renderer #141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Loop edge renderer #141
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Introduces logic to render self-referential edges (loops) in ArrowEdgeRenderer, SugiyamaEdgeRenderer, and TreeEdgeRenderer. Adds buildSelfLoopPath utility and corresponding test coverage for loop path generation.
Refactored addEdgeS to prevent adding duplicate nodes when an edge is a self-loop. Added a test to verify that self-loop edges do not result in multiple instances of the same node.
Replaces arc-based loop edge rendering with a cubic Bezier curve for improved control over loop shape. Updates start, end, and control point calculations to use node position and dimensions, enhancing visual consistency and flexibility.
Ensures that edge data, such as bend points, is retained when edges are reversed in the SugiyamaAlgorithm. This prevents loss of associated metadata during edge manipulation and improves graph consistency.
Improved the restoreCycle method by adding null checks, using toList() for safe iteration, and clearing the reversed list after restoration. This enhances code safety and prevents potential runtime errors.
Added a check to initialize coordinates when empty and skip empty layers in overlap resolution. Added a test to verify SugiyamaAlgorithm handles a single node with a self-loop without errors.
…ulation-and-tests Adjust self-loop control points for smooth tangents
Owner
|
This is perfect, @ThalesMMS , can you please share some screenshots? Would love to see the actual UI for Sugiyama layout |
Owner
|
@ThalesMMS Please fix the test if possible |
Contributor
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.


This pull request introduces improved support for self-loop edges (edges where the source and destination are the same node) throughout the graph rendering and layout codebase. It adds robust handling for self-loops in rendering, ensures nodes are not duplicated, and enhances the Sugiyama algorithm to correctly process self-loops. Comprehensive tests have also been added to verify these behaviors.
Self-loop rendering enhancements:
buildSelfLoopPathmethod toEdgeRenderer, allowing all renderers to create and draw self-loop paths with optional arrowheads. This is now used inArrowEdgeRenderer,SugiyamaEdgeRenderer, andTreeEdgeRendererto properly visualize self-loops. [1] [2] [3] [4]Graph structure and algorithm improvements:
Graph.addEdgeSto prevent node duplication when adding self-loops, ensuring a single node instance is used and not added multiple times.SugiyamaAlgorithmto correctly handle self-loops and reversed edges, including preserving edge data when reversing, initializing coordinates for empty layers, and restoring cycles with proper edge data. [1] [2] [3] [4] [5]Rendering consistency:
Testing improvements:
SugiyamaAlgorithmrobustly handles graphs with self-loops.