Rings
A flywheel, a PDCA loop or a release cycle is a cycle, and the loop is the point of the diagram. Laid out in layers, a cycle becomes a column with one long edge running back to the top. Merlion draws two kinds of cycle as a ring instead, from plain Mermaid with no new syntax:
- a subgraph whose nodes, 3 to 16 of them, are joined by exactly one directed cycle;
- a group of 3 to 16 connected nodes outside every subgraph that is exactly one cycle.
Diagram source
flowchart LR accTitle: A ring outside any subgraph build[Build] --> measure[Measure] --> learn[Learn] --> buildThe members sit on a circle in cycle order, starting at the top with the first one declared, and each cycle edge follows the circle. Edge labels sit on their arcs. Shapes, roles, classDef colours and title + detail labels work as they do anywhere else in a flowchart.
Diagram source
flowchart TB accTitle: A labelled ring in a subgraph, with edges in and out customer[Customer request] --> plan subgraph cycle[PDCA] plan[Plan] -->|ship| do[Do] -->|observe| check[Check] -->|decide| act[Act] -->|repeat| plan end act --> report[Quarterly report]Rings and the rest of the diagram
Section titled “Rings and the rest of the diagram”Everything outside a ring is laid out by the layered engine, with the ring taking the room of one large node. The ring is then turned, and mirrored where that helps, so the members with links out face the nodes they link to. A link runs straight between the two nodes when it crosses nothing; otherwise it follows the engine’s route to the ring and goes round the ring’s edge to its member, never through the middle. Two linked flywheels face each other:
Diagram source
flowchart LR accTitle: Two flywheels sharing a catalog subgraph supply["Supply flywheel"] s1["**1 Recruit sellers**<br/>sellers onboarded"] --> s2["**2 More listings**<br/>listings per seller"] s2 --> s3["**3 Wider selection**<br/>categories covered"] --> s4["**4 Lower prices**<br/>median price change"] s4 --> s5["**5 Faster delivery**<br/>days to doorstep"] --> s6["**6 Seller revenue**<br/>revenue per seller"] --> s1 end subgraph demand["Demand flywheel"] d1["**1 New buyers**<br/>signups by source"] --> d2["**2 First order**<br/>converted in 7 days"] d2 --> d3["**3 Repeat orders**<br/>orders per buyer"] --> d4["**4 Reviews**<br/>reviews per order"] d4 --> d5["**5 Referrals**<br/>invites accepted"] --> d6["**6 Retention**<br/>active after 90 days"] --> d1 end catalog[("**Shared catalog**<br/>listings and reviews")] s5 -->|listings| catalog catalog -->|search results| d1 d5 -.->|price feedback| s4Two rings side by side need the width for both plus the edge labels between them. In a narrower container, automatic orientation stacks them instead; pass a wider width, or shorten the labels on the links, to keep them side by side.
What is not a ring
Section titled “What is not a ring”A cycle stays in layers when any of these holds:
- a chord, a self-loop or a second edge between two members, so the edges are no longer one cycle;
- an invisible
~~~edge among the members; - a subgraph nested inside the ring’s subgraph;
- fewer than 3 or more than 16 members;
- a group outside every subgraph that touches a subgraph node.
State diagrams always lay their cycles out in layers.
Keeping the layered drawing
Section titled “Keeping the layered drawing”A direction statement inside a subgraph keeps that subgraph in layers:
flowchart LR subgraph retry[Retry loop] direction TB send[Send] --> wait[Wait] --> check{Delivered?} --> send endTo turn rings off for a whole diagram, set merlion.rings in front matter or an %%{init}%% directive. Mermaid ignores the key, so the source still renders there:
---config: merlion: rings: false---flowchart LR build[Build] --> measure[Measure] --> learn[Learn] --> buildThe exact rules (slot angles, radius, clearances, routing tests and fuel) are in layout.md § Rings.