code: def dot(self, p_print_labels=True):
          
          out = 'digraph g {\n'
  
          for from_node, neighbors in sorted(self._edges.items()):
              out += "  {}\n".format(from_node)
  
              for neighbor in sorted(neighbors):
                  out += "  {} -> {}".format(from_node, neighbor)
  
                  edge_id = self.edge_id(from_node, neighbor)
                  if edge_id and p_print_labels:
                      out += ' [label="{}"]'.format(edge_id)
  
                  out += "\n"
  
          out += '}\n'
          return out
docs: Prints the graph in Dot format.