Activity diagrams: decision and merge nodes
Introduction
Activity diagrams model business processes in a system. The core elements are decision nodes (branching logic) and merge nodes (converging paths). Both are drawn as diamonds: a decision node picks a branch based on a condition, while a merge node brings multiple paths back together. This article uses the same login flow example in both PlantUML and Mermaid to compare syntax and rendering.
PlantUML
1 | @startuml |
PlantUML uses if (...) then (...) else (...) endif to express decision nodes; merge nodes are implied by endif. The |Client| swimlane syntax tracks the actor. Branch labels like (Yes) / (No) are written directly after then / else.
Mermaid
1 | flowchart TD |
Mermaid draws decision nodes with { } (diamond shape). Branch labels are placed on edges using |Yes| / |No| syntax. A merge node is simply two edges converging on the same target node — no explicit merge syntax required. Mermaid does not support swimlanes natively, but subgraph can approximate the effect.
Side by side
| Feature | PlantUML | Mermaid |
|---|---|---|
| Decision node syntax | if (...) then (...) else (...) endif |
{ } diamond node |
| Merge node | implicit via endif |
edges converge on same target node |
| Branch labels | (Yes) / (No) after then/else |
` |
| Swimlanes | |Actor| native support |
not supported, use subgraph instead |
| Start/end | start / stop keywords |
plain nodes, no explicit start/end |
Wrap-up
Decision and merge nodes are the basic building blocks of activity diagrams. PlantUML’s if/endif structure reads like code and scales well for deeply nested conditions. Mermaid’s { } nodes with edge labels are more visual and require less ceremony for straightforward flows. Both clearly express branching and convergence; pick based on your team’s toolchain and the diagram’s complexity.
- Title: Activity diagrams: decision and merge nodes
- Author: puml.online
- Created at : 2026-09-09 09:00:00
- Updated at : 2026-12-06 10:29:22
- Link: https://puml.online/en/blog/activity-diagram-decision-merge/
- License: This work is licensed under CC BY-NC-SA 4.0.