
salvo.jesus.graph.Path Maven / Gradle / Ivy
Show all versions of OpenJGraph Show documentation
package salvo.jesus.graph;
/**
* An interface that abstracts a path in a graph. In this context,
* a path is a consecutive sequence of vertices from one vertex
* to another connected by edges.
*
* The important word here is consecutive. Thus, implementations
* are required to make sure that if an Edge is added to a
* Path, that the Edge being added is between
* the last Vertex in the path to a new Vertex.
* If a Vertex is being added, that am Edge is
* created between the last Vertex in the Path to
* the new Vertex being added.
*
* If an acyclic path is required, then implement the AcyclicPath
* interface instead.
*
* @author Jesus M. Salvo Jr.
*/
public interface Path extends Graph {
/**
* Returns the first Vertex in the Path.
*/
public Vertex getFirstVertex();
/**
* Returns the last Vertex in the Path.
*/
public Vertex getLastVertex();
/**
* Removes the last Vertex that was added in the Path.
*/
public void remove() throws Exception;
}