Bidirectional arrows (A <--> B) force the involved nodes to be on different levels, with the first-mentioned one being placed higher up even if the nodes would be on the same level without the addition of the bidirectional link. This seems unnecessary and often yields undesirable results. Adding a bidirectional link should not change the relative ranking of the nodes.
Steps to reproduce
Example 1: without bidirectional link - A and B are on the same level.
flowchart TD
C --> A & B
Example 2: with bidirectional link - now B is forced down one level. The diagram would look much nicer if everything stayed as in the previous example, just with the extra arrow.
flowchart TD
C --> A & B
A <--> B
Example 3: without bidirectional link - A and B are on the same level.
flowchart TD
C --> A & B
A --> D
B --> E
Example 4: with bidirectional link - now B is forced down one level. The diagram would look much nicer if everything stayed as in the previous example, just with the extra arrow.
flowchart TD
C --> A & B
A --> D
B --> E
A <--> B
Screenshots
No response
Code Sample
No response
Setup
Mermaid version: 10.3.1
Browser and Version: Edge
Suggested Solutions
I know too little about the placement algorithm to make a useful suggestion. Could it be possible to just ignore bidirectional links for the purposes of determining the level on which to place a node? (Is the placement algorithm described / documented somewhere?)
Additional Context
Note that this is different from https://github.com/mermaid-js/mermaid/issues/4317 which is about keeping nodes on the same level even if they are connected by unidirectional links. While that issue would clearly require special treatment / syntax, I would hope that the issue described here could give a general improvement of the default placement behavior.
Description
Bidirectional arrows (A <--> B) force the involved nodes to be on different levels, with the first-mentioned one being placed higher up even if the nodes would be on the same level without the addition of the bidirectional link. This seems unnecessary and often yields undesirable results. Adding a bidirectional link should not change the relative ranking of the nodes.
Steps to reproduce
Example 1: without bidirectional link - A and B are on the same level.
Example 2: with bidirectional link - now B is forced down one level. The diagram would look much nicer if everything stayed as in the previous example, just with the extra arrow.
Example 3: without bidirectional link - A and B are on the same level.
Example 4: with bidirectional link - now B is forced down one level. The diagram would look much nicer if everything stayed as in the previous example, just with the extra arrow.
Screenshots
No response
Code Sample
No response
Setup
Suggested Solutions
I know too little about the placement algorithm to make a useful suggestion. Could it be possible to just ignore bidirectional links for the purposes of determining the level on which to place a node? (Is the placement algorithm described / documented somewhere?)
Additional Context
Note that this is different from https://github.com/mermaid-js/mermaid/issues/4317 which is about keeping nodes on the same level even if they are connected by unidirectional links. While that issue would clearly require special treatment / syntax, I would hope that the issue described here could give a general improvement of the default placement behavior.