Skip to content

Mermaid NestedGraph does not create transitions between outer states that do not have labels #706

@oEscal

Description

@oEscal

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:

Image

The expected graph is:

Image

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions