import java.util.Collection; /** * Interface specifying a graph */ public interface Graph { /** * Return the collection of vertices of this graph * @return the vertices as a collection (which is anything iterable) */ public Collection vertices(); /** * Return a collection of vertices adjacent to a given vertex v. * i.e., the set of all vertices w where edges v -> w exist in the graph. * @param v one of the vertices in the graph * @return an iterable collection of vertices adjacent to v in the graph */ public Collection adjacentVertices(Vertex v); /** * Test whether vertex b is adjacent to vertex a (i.e. a -> b) * in a directed graph. * @param a one vertex * @param b another vertex * @return true if there is a directed edge from a to b in the graph * Return false otherwise. * (Including returning false if one of the two vertices does not exist.) */ public boolean isAdjacent(Vertex a, Vertex b); }