Managing a complex Mermaid diagram that includes numerous subgraphs can be challenging. The size of the diagram often makes it difficult to maintain the correct order of subgraphs, leading to occasional rearrangements for clarity and positioning.
However, the sequence of subgraphs is crucial as the placement of nodes in Markdown determines their association with specific subgraphs. This means that changing the order of subgraphs can alter the overall structure of the diagram.
For example, consider the following code:
flowchart LR
subgraph Subgraph 1
A
end
subgraph Subgraph 2
A --> B
end
This code renders in one way, while the same code with reversed subgraph order displays differently:
flowchart LR
subgraph Subgraph 2
A --> B
end
subgraph Subgraph 1
A
end
It raises the question of whether there is a method to anchor a node permanently to a particular subgraph irrespective of any reordering. One suggestion could be introducing a marker like A$
, where the $
sign signifies that Node A should always be linked to that specific subgraph.