terrastruct / d2

D2 is a modern diagram scripting language that turns text to diagrams.
https://d2lang.com
Mozilla Public License 2.0
18.04k stars 441 forks source link

d2 generates asymmetric figure #724

Open ningcng opened 1 year ago

ningcng commented 1 year ago
A -> B
A -> C
C -> B
B -> C
B -> D
C -> E

B and C, D and E should be symmetric but the generated figured is not.

gavin-ts commented 1 year ago

Reproducing: https://play.d2lang.com/?script=clTQtVNw4gJTzlzOEJ4ThAemXCCCrlyAAAAA__8%3D& d2

To clarify, I think the desired layout is to have B and C on the same level, and then D and E on the same level below, with horizontal edges between B and C (on the same level).

Like this but with the horizontal edges between B and C. Screen Shot 2023-01-26 at 2 59 44 PM

That being said I don't know if dagre really supports edges between nodes on the same level since it interprets an edge between them to mean they should be on different levels.