Graph Interface: Directed Graph

  • Notice the Graph ADT represents a directed graph.

The Graph interface is meant to be a general interface for directed graphs.

/**
 * Graph ADT to represent directed graphs.
 *
 * @param <V> Vertex element type.
 * @param <E> Edge element type.
 */
public interface Graph<V, E> {
  // Operations not shown
}

Let's note that you can use a directed graph to represent an undirected graph.

A directed Graph is a generalization of an undirected graph. If you need an undirected graph, simply insert two directed edges (presumably with the same data), one in each direction.