def print_network(self):  # pragma: no cover
        """
        Generate a graphviz compatible graph.

        """
        edges = set()

        def gen_edges(node):
            nonlocal edges
            name = str(id(node))

            yield '{name} [label="{cls_name}"];'.format(
                name=name,
                cls_name=str(node))

            for child in node.children:
                if (node, child.callback) not in edges:
                    yield ('{parent} -> {child} '
                           '[label="{child_label}"];').format(
                        parent=name,
                        child=str(id(child.node)),
                        child_label=child.callback.__name__)
                    edges.add((node, child.callback))
                yield from gen_edges(child.node)

        return "digraph {\n %s \n}" % ("\n".join(
            gen_edges(self.root_node)))
def print_network ( self ) : edges = set ( ) def gen_edges ( node ) : nonlocal edges name = str ( id ( node ) ) yield '{name} [label="{cls_name}"];' . format ( name = name , cls_name = str ( node ) ) for child in node . children : if ( node , child . callback ) not in edges : yield ( '{parent} -> {child} ' '[label="{child_label}"];' ) . format ( parent = name , child = str ( id ( child . node ) ) , child_label = child . callback . __name__ ) edges . add ( ( node , child . callback ) ) yield from gen_edges ( child . node ) return "digraph {\n %s \n}" % ( "\n" . join ( gen_edges ( self . root_node ) ) )
Generate a graphviz compatible graph.