Mermaid NestedGraph does not create transitions between outer states that do not have labels
Author: oEscalCreated Jun 18, 2025Updated Jul 3, 2025
Labelsbug
Describe the bug
When I create a HierarchicalGraphMachine and try to generate the graph diagram with the mermaid engine, the resultant Mermaid code does not specify the transitions between actions that do not have labels.
Minimal working example This is the same example as in diagrams, but I have removed the transitions labels:
from transitions.extensions.diagrams import HierarchicalGraphMachine
states = ['A', 'B', {'name': 'C',
'final': True,
'parallel': [{'name': '1', 'children': ['a', {"name": "b", "final": True}],
'initial': 'a',
'transitions': [['go', 'a', 'b']]},
{'name': '2', 'children': ['a', {"name": "b", "final": True}],
'initial': 'a',
'transitions': [['go', 'a', 'b']]}]}]
transitions = [['', 'C', 'A'], ["", "A", "B"], ["", "B", "C"]]
m = HierarchicalGraphMachine(states=states, transitions=transitions, initial="A", show_conditions=True,
title="Mermaid", graph_engine="mermaid", auto_transitions=False)
print(m.get_graph().draw(None))Expected behavior The produced Mermaid code should represent the transitions between A, B, and C. However, the code leads to the following graph:
The expected graph is:
Source: pytransitions/transitions