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 the collection of edges of this graph * @return the edges as a collection (which is anything iterable) */ public Collection edges(); /** * Return a collection of edges incident to (i.e. emanating from) * a given vertex v. * i.e., the set of all edges v->w * @param v one of the vertices in the graph * @return an iterable collection of edges incident to v in the graph */ public Collection incidentEdges(Vertex v); /** * Test whether two vertices are adjacent in the graph * @param v one vertex * @param w another vertex * @return true if there is an edge from v to w in the graph, false otherwise */ public boolean isAdjacent(Vertex v, Vertex w); }