Closed seanxlliu closed 4 months ago
Hi @seanxlliu,
i am not sure whether this is still relevant for you: You pass show_roi=True
as an option which will only pass 'reachable' from the current state. In state 'NoShow', only 'kickin' and 'leave' can be triggered and thus only 'NoShow' and Docked (and its parallel states) can be reached. If you want the whole graph to be draw, either pass show_roi=False
or omit the argument altogether. That being said, show_roi=True
is not working well with parallel states as of now since there are some corner cases to consider.
This has been tackled by #634. I will close this issue for now. Feel free to comment if this is still an issue for you. I will reopen the issue if necessary.
from transitions.extensions import LockedHierarchicalGraphMachine as HSM
class Plane:
def __init__(self):
states = [
"NoShow",
{
"name": "Docked",
"parallel": [
{"name": "Refuel", "children": ["N", "Y"], 'initial': 'N'},
{"name": "Baggage", "children": ["N", "Y"], 'initial': 'N'},
{"name": "Meal", "children": ["N", "Y"], 'initial': 'N'},
],
},
]
transitions = [
["kickin", "NoShow", "Docked"],
["refuel", "Docked_Refuel_N", "Docked_Refuel_Y"],
["load_baggage", "Docked_Baggage_N", "Docked_Baggage_Y"],
["meal", "Docked_Meal_N", "Docked_Meal_Y"],
["leave", "*", "NoShow"],
]
self.machine = HSM(
model=self,
states=states,
transitions=transitions,
initial="NoShow",
ignore_invalid_triggers=True,
use_pygraphviz=False,
# show_auto_transitions=True
)
plan = Plane()
plan.get_graph().draw('state_diagram.png', prog='dot')
plan.get_graph(show_roi=True).draw('state_diagram_roi.png', prog='dot')
Thank you for taking the time to report a bug! Your support is essential for the maintenance of this project. Please fill out the following fields to ease bug hunting and resolving this issue as soon as possible:
Describe the bug Parallel states work with HSM as expected, but failed to generate state diagram with GraphMachine
Minimal working example
Expected behavior The diagram should show all defined transitions
Additional context N/A