lib.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:simple-markov 作者: Mandragorian 项目源码 文件源码
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
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号