def explore(self, graph, visitor):
    visitor.visit_begin_graph(graph)
    for node in sorted(graph.nodes):
        logging.debug(('Visiting ' + node))
        visitor.visit_node(graph.nodes[node])
        for succ in sorted(graph.nodes[node].successors):
            logging.debug(('Visiting edge: %s -> %s ' % (node, succ)))
            visitor.visit_edge(graph.nodes[node], graph.nodes[succ])
    visitor.visit_end_of_graph()
def explore(self, graph, visitor):
    visitor.visit_begin_graph(graph)
    for node in sorted(graph.nodes):
        logging.debug(('Visiting ' + node))
        visitor.visit_node(graph.nodes[node])
        for succ in sorted(graph.nodes[node].successors):
            logging.debug(('Visiting edge: %s -> %s ' % (node, succ)))
            visitor.visit_edge(graph.nodes[node], graph.nodes[succ])
    visitor.visit_end_of_graph()