Activity diagrams: swimlanes / partitions
简介 / Introduction
Activity diagrams describe the flow of actions in a business process. Swimlanes group actions by responsible party or system partition, making the flow clear at a glance. PlantUML has native swimlane syntax; Mermaid approximates it with flowchart subgraphs.
PlantUML 版
PlantUML uses |partition name| to declare swimlanes; actions inside a partition belong to that lane.
1 | @startuml |
PlantUML swimlanes are automatically arranged vertically, with arrows connecting action nodes across partitions.
Mermaid 版
Mermaid flowchart has no native swimlane syntax; use subgraph with LR or TD direction to approximate partitions:
1 | flowchart LR |
Note that Mermaid subgraphs do not auto-align between groups; you must manually order nodes to simulate swimlane behavior.
对比 / Side-by-side
| Feature | PlantUML | Mermaid |
|---|---|---|
| Swimlane syntax | |partition| native |
No native swimlanes, use subgraph |
| Partition layout | Auto vertical alignment | Manual node ordering required |
| Conditional branch | if/else/endif |
B2{} decision node |
| Parallel paths | fork/join |
Not supported |
| Diagram type | activity diagram | flowchart |
小结 / Wrap-up
PlantUML’s |swimlane| syntax is the standard implementation for activity diagram swimlanes, ideal for formal business process documentation. Mermaid approximates swimlanes with flowchart subgraphs — faster to set up and integrate — but requires extra care for partition alignment. For precise swimlane layout, use PlantUML; if you are already in the Mermaid ecosystem, the subgraph compromise is acceptable.
- Title: Activity diagrams: swimlanes / partitions
- Author: puml.online
- Created at : 2026-09-08 09:00:00
- Updated at : 2026-09-29 01:06:38
- Link: https://puml.online/blog/activity-diagram-swimlanes-en/
- License: This work is licensed under CC BY-NC-SA 4.0.