Skip to content
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

Fix dagre.js for abnormal wide edges #1254

Closed
wants to merge 1 commit into from

Conversation

seanshpark
Copy link

@seanshpark seanshpark commented Apr 1, 2024

This will update dagre.js for abnormal wide edges

@seanshpark
Copy link
Author

seanshpark commented Apr 1, 2024

this change has suggestion from @beru at #1246 (comment)

but still this part goes bad

before after
image image

@seanshpark
Copy link
Author

I'm still reading the papers of Dagre ... and looks like will take a while.

@beru
Copy link

beru commented Apr 8, 2024

@seanshpark

The code I wrote in #1246 (comment) didn't make much sense so I did some experiment. https://github.com/beru/netron/commits/horizontalCompaction/

It was difficult for me to understand buildBlockGraph and the second pass of horizontalCompaction so I decided to write another routine to remove unused space. The code quality is low but don't throw stones at me.

vert2_saved_model pbtxt

@seanshpark
Copy link
Author

@beru, Wow, you've got the sample working !

It was difficult for me to understand buildBlockGraph and the second pass of horizontalCompaction

Algorithms are described in the papers in https://github.com/dagrejs/dagre/wiki#recommended-reading (I think you may know the links) and still reading these hard-to-understand algorithms in my spare time ...
I'll also take a look at your code :)
BTW, what about posting a PR ?

@beru
Copy link

beru commented Apr 9, 2024

Algorithms are described in the papers in https://github.com/dagrejs/dagre/wiki#recommended-reading (I think you may know the links)

Thank you for the info. I didn't know the wiki of dagre project or maybe I just forgot it? Anyway, I'll try to understand what's written on the paper.

BTW, what about posting a PR ?

I wish to do so if I'll be able to come up with more polished code. The code I wrote doesn't use the second pass at all (as I'm not capable of understanding it) but that's probablly not a good idea.

@seanshpark
Copy link
Author

@lutzroeder , I've update the patch with what I understand as of now.
For the problem of undesired long edges are from the dummy nodes in dagre.
This change will skip for calculating the position for dummy elements,
so that they don't go to some unwanted position.

But still there exist a problem with the model you've provided and the result is same as in #1254 (comment) capture.
What I know is that this particular node input/output is reversed in Y position.
I hope I could find the cause to fix the degradation someday :)

If possible can you please land current change?

This will update dagre.js for abnormal wide edges
@seanshpark
Copy link
Author

@lutzroeder , I've updated for CI build fail.

lutzroeder added a commit that referenced this pull request May 25, 2024
@lutzroeder lutzroeder closed this May 25, 2024
@seanshpark seanshpark deleted the fix_wide_edge branch May 25, 2024 02:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants