def to_dot(self):
"""Produces a ball and stick graph of this state machine.
Returns
-------
`graphviz.Digraph`
A ball and stick visualization of this state machine.
"""
from graphviz import Digraph
dot = Digraph(format='png')
for state in self.states:
if isinstance(state, TransientState):
dot.node(state.name(), style='dashed')
else:
dot.node(state.name())
for transition in state.transition_set:
dot.edge(state.name(), transition.output.name(), transition.label())
return dot
评论列表
文章目录