-
Notifications
You must be signed in to change notification settings - Fork 661
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
ERD: Improve auto layout #6592
Comments
May also be related to #5199 |
seeing identical behavior on pgadmin 7.8 on Mac - after generating an ERD for an existing database, not only do the relationship lines look pretty wild, but they also have anchor points that don't reset and aren't movable/editable. Note that this seems to be the only issue preventing an autogenerated ERD from being useful - everything else looks pretty good! |
Any progress on this or can someone point me in the direction where i can start working on it? |
Hi @raprocks, |
For comparison, I'm attaching an auto-generated er diagram of the same (very simple) db done with pgAdmin4 v7.8 and a proprietary software (Navicat Data Modeler 3). I'm no expert, but maybe a first step in the right direction could be switching to RightAngleLinks as per (I'm with @wayland in that this looks more like a bugfix than a feature-request. I do recognize that automatic laying-out is very complex to get right, and will probably require many iterations). |
@carlo-salinari The major difference between pgAdmin ERD and the ERD which you shared is - The links in pgAdmin start from the actual column used, and not just randomly sticking the link anywhere. |
@adityatoshniwal I believe from the end-user perspective the major difference is in terms of clarity, so to speak. And that seems to come from the routing around (and not behind) the tables, better use of spacing and grouping, predictability of the links, overall less graphical noise from the background and better color contrast. The direct connection to the column certainly complicates routing a bit, but it could probably be maintained. It would be interesting to find comparisons. |
@carlo-salinari I had tried to find a suitable algorithm to keep links on column and auto layout. But unfortunately didn't find anything concrete. I think at some point we'll have to let it go in favour of better clarity. In future if we find a suitable algo then we can link back to columns as an improvement. |
@adityatoshniwal You mean let go of the link-to-key constraint? That's something to experiment with, but I don't think that's the crux of the problem here. Automatic graph layout is a notoriously hard problem: there is no clearly understood metric to evaluate the results and the complexity varies wildly with graph input size and constraints number. These two aspects will keep coming up while looking for a solution (even a partial one). It's unlikely that we'll be able to find a ready-made robust algorithm able to handle arbitrarily sized schemas right away, even removing the link-to-key constraint. A more pragmatic approach would be to work step-wise, i.e.:
This seems more or less the approach currently followed by all other similar applications. And eventually some magic machine-learning solution will materialize, capturing all the aesthetic requirements :) |
This is a sample of an auto-generated erd graph with maintained link-to-key constraints (https://www.softwareideas.net/en/erd-auto-generator).
|
Only javascript library I could find tackling erd diagrams decently: https://gojs.net/latest/samples/entityRelationship.html Unfortunately, I don't think their license is compatible with pgAdmin's. |
Other people (eg. DataWharf) seem to be using maxGraph (basically mxGraph, but gets updates). They're under an Apache-style license; no idea about compatibility. https://github.com/maxGraph/maxGraph HTH, |
It would be very helpful to add a feature to manually move the nodes of the lines manually by clicking and dragging. That way it would be a lot easier to tidy up an auto generated ERD. The ability to manually insert and delete nodes on a line segment would also come in handy. |
It seems like orthogonal lines is the way |
@RieBi ERD tool lines works fine when building from scratch. The issue is with auto layout. I will go through all the suggestions and see how we can fix it. |
This is clearly a 'bug' not a 'feature' from end user perspective. Also this issue should get a better priority imo. |
Feel free to raise a PR if you have a solution. I've spend a lot of time in past, may be there is one available today. |
- Always generate right-angled links - Switch port to Left/Right for the best link route.
Point no.1 and 3 will be fixed with my PR here - #8167. |
Point no. 1 and 2 has been fixed and verified in snapshot build. For point no. 2 we will create a new issue. |
Opened #8212 |
Describe the solution you'd like
Currently, the auto layout in ERD places the nodes correctly but links are:
This can be improved by using a better algorithm.
The text was updated successfully, but these errors were encountered: