def to_adjacency
      result = (directed? ? DirectedAdjacencyGraph : AdjacencyGraph).new
      each_vertex { |v| result.add_vertex(v) }
      each_edge { |u,v| result.add_edge(u, v) }
      result
    end
def to_adjacency
      result = (directed? ? DirectedAdjacencyGraph : AdjacencyGraph).new
      each_vertex { |v| result.add_vertex(v) }
      each_edge { |u,v| result.add_edge(u, v) }
      result
    end
Convert a general graph to an AdjacencyGraph.  If the graph is directed,
 returns a DirectedAdjacencyGraph; otherwise, returns an AdjacencyGraph.