Package org.jgrapht
Interface GraphPath<V,E>
-
- Type Parameters:
V
- the graph vertex typeE
- the graph edge type
- All Known Implementing Classes:
GraphWalk
public interface GraphPath<V,E>
A GraphPath represents a path in aGraph
. Unlike some definitions, the path is not required to be a Simple Path.- Author:
- John Sichi
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default java.util.List<E>
getEdgeList()
Returns the edges making up the path.V
getEndVertex()
Returns the end vertex in the path.Graph<V,E>
getGraph()
Returns the graph over which this path is defined.default int
getLength()
Returns the length of the path, measured in the number of edges.V
getStartVertex()
Returns the start vertex in the path.default java.util.List<V>
getVertexList()
Returns the path as a sequence of vertices.double
getWeight()
Returns the weight assigned to the path.
-
-
-
Method Detail
-
getGraph
Graph<V,E> getGraph()
Returns the graph over which this path is defined. The path may also be valid with respect to other graphs.- Returns:
- the containing graph
-
getStartVertex
V getStartVertex()
Returns the start vertex in the path.- Returns:
- the start vertex
-
getEndVertex
V getEndVertex()
Returns the end vertex in the path.- Returns:
- the end vertex
-
getEdgeList
default java.util.List<E> getEdgeList()
Returns the edges making up the path. The first edge in this path is incident to the start vertex. The last edge is incident to the end vertex. The vertices along the path can be obtained by traversing from the start vertex, finding its opposite across the first edge, and then doing the same successively across subsequent edges; seegetVertexList()
.Whether or not the returned edge list is modifiable depends on the path implementation.
- Returns:
- list of edges traversed by the path
-
getVertexList
default java.util.List<V> getVertexList()
Returns the path as a sequence of vertices.- Returns:
- path, denoted by a list of vertices
-
getWeight
double getWeight()
Returns the weight assigned to the path. Typically, this will be the sum of the weights of the edge list entries (as defined by the containing graph), but some path implementations may use other definitions.- Returns:
- the weight of the path
-
getLength
default int getLength()
Returns the length of the path, measured in the number of edges.- Returns:
- the length of the path, measured in the number of edges
-
-