public String toString() {
    StringBuilder sb = new StringBuilder();
//     sb.append("Edges:");
//     for (Edge<E> e : edges) {
//       Vertex<V>[] verts = endVertices(e);
//       sb.append(String.format(" (%s->%s, %s)", verts[0].getElement(), verts[1].getElement(), e.getElement()));
//     }
//     sb.append("\n");
    for (Vertex<V> v : vertices) {
      sb.append("Vertex " + v.getElement() + "\n");
      if (isDirected)
        sb.append(" [outgoing]");
      sb.append(" " + outDegree(v) + " adjacencies:");
      for (Edge<E> e: outgoingEdges(v))
        sb.append(String.format(" (%s, %s)", opposite(v,e).getElement(), e.getElement()));
      sb.append("\n");
      if (isDirected) {
        sb.append(" [incoming]");
        sb.append(" " + inDegree(v) + " adjacencies:");
        for (Edge<E> e: incomingEdges(v))
          sb.append(String.format(" (%s, %s)", opposite(v,e).getElement(), e.getElement()));
        sb.append("\n");
      }
    }
    return sb.toString();
  }