def get_graph(self, title=None):
""" Generate a DOT graph with pygraphviz, returns an AGraph object
Args:
title (string): Optional title for the graph.
"""
if not pgv:
raise Exception('AGraph diagram requires pygraphviz')
if title is None:
title = self.__class__.__name__
elif title is False:
title = ''
fsm_graph = pgv.AGraph(label=title, compound=True, **self.machine_attributes)
fsm_graph.node_attr.update(self.style_attributes['node']['default'])
# For each state, draw a circle
self._add_nodes(self.machine.states, fsm_graph)
self._add_edges(self.machine.events, fsm_graph)
setattr(fsm_graph, 'style_attributes', self.style_attributes)
return fsm_graph
diagrams.py 文件源码
python
阅读 21
收藏 0
点赞 0
评论 0
评论列表
文章目录