-
Notifications
You must be signed in to change notification settings - Fork 529
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HierarchicalGraphMachine bug: transitions defined in 'parallel' or 'children' cannot be displayed in the graph, but it works #413
Comments
The behavior I desired is: the graph can show the internal transitions defined in the substate, and in addition the |
Hi @xiaohuihui1024, thank you for the report and your test case. Transitions should be shown regardless where they originate and where they are going. I guess that edges are currently not correctly collected for the new HSM version. I will have a look and report back! |
- for both graphviz and pygraphviz use dest if state is an enum improve graph generation for nested graphs (#413)
The error you have found has been fixed. I also improved the layout of parallel states a bit. However, parallel state/transition support is still work in progress. Only the last transition can be shown at the moment. Since from transitions.extensions.factory import HierarchicalGraphMachine as Machine
import logging
states = ['A', 'B', {'name': 'C', 'parallel': [{'name': '1', 'children': ['a', 'b', 'c'], 'initial': 'a',
'transitions': [['go', 'a', 'b']]},
{'name': '2', 'children': ['x', 'y', 'z'], 'initial': 'z'}],
'transitions': [['go', '2_z', '2_x']]}]
transitions = [['reset', 'C_1_b', 'B'], ['start', 'A', 'C']]
logging.basicConfig(level=logging.INFO)
Machine.hierarchical_machine_attributes['ranksep'] = '0.3' # shorter edges
extra_args = dict(show_conditions=True, show_state_attributes=True, use_pygraphviz=False)
machine = Machine(states=states, transitions=transitions, initial='A', **extra_args)
machine.start()
machine.get_graph().draw('diagram_01.png', prog='dot')
machine.go()
machine.get_graph().draw('diagram_02.png', prog='dot') I will close this issue for now but please do not hestitate to comment if you find further problems with diagrams or (py)graphviz. I will reopen the issue if necessary. |
Using:
Windows 10 64 bit
Python 3.7.4 (Anaconda)
transitions 0.8.0
Graphviz 2.38.0 (binary)
graphviz 0.13.2 (python package)
The following code is from
README.md
and changesHierarchicalMachine
toHierarchicalGraphMachine
because I want to visualize parallel HSMThis produces the graph like this:
Note: The transition from
C_1_a
toC_1_b
is not shown, but it is defined instates
then I try the following triggers:
It can be found from the log output that
C_1_a
->C_1_b
did occur, but it cannot be displayed in the graph.Changing the
states
definition in the above code to the following also happens.Is this expected behavior ?
The text was updated successfully, but these errors were encountered: