def to_dot(self, return_graph=False):
"""
Creates a DOT format representation of this chain, where states
are represented as labelled nodes and transitions as directed arcs
labelled by their probabilities. If return_graph is set to True,
the graphviz.Digraph object that contains the representation is
returned instead.
:param return_graph: a boolean indicating if the underlying Digraph
object should be returned instead of the string representation
:returns: a representation of the chain in DOT format
"""
graph = gv.Digraph(format='svg')
for st in self.states.values():
st.populate_graph(graph)
return graph if return_graph else graph.source
评论列表
文章目录