V
- the type of the verticespublic class PathByID<V extends Vertex> extends WalkByID<V>
Graph
using the identifiers of the vertices.
WalkByID
that does not include any vertex twice, except that its first vertex might be the same as its last.
PathByID
to serialize a Path
. If you deserialize a PathByID
keep in mind to set the associated graph with
WalkByID.setGraph(Graph)
otherwise the path is not functioning any more.
cast()
to convert this path using vertex identifiers in a Path
using concrete Vertex
s.WalkByID
,
TrailByID
,
Serialized FormConstructor and Description |
---|
PathByID(Graph<V,? extends Edge> graph)
Creates an empty path.
|
PathByID(Graph<V,? extends Edge> graph,
java.lang.Integer[] path)
Creates a path based on a predefined path.
|
PathByID(Graph<V,? extends Edge> graph,
java.util.List<java.lang.Integer> path)
Creates a path based on a predefined path.
|
Modifier and Type | Method and Description |
---|---|
void |
add(int vertexID)
Adds a new vertex to the path.
|
Path<V> |
cast()
|
PathByID<V> |
clone()
Gets a shallow copy of this path (the identifiers of the vertices in the path are not cloned).
|
boolean |
equals(java.lang.Object o)
Indicates whether this path equals the specified one.
|
boolean |
equals(PathByID<V> p)
Indicates whether this path equals the specified one.
|
boolean |
isClosed()
Indicates whether the path is a cycle meaning that the path begins and ends on the same vertex.
|
void |
removeLast()
Removes the last vertex of the path.
|
public PathByID(Graph<V,? extends Edge> graph) throws java.lang.IllegalArgumentException
graph
- the graph its vertices can be part of this pathjava.lang.IllegalArgumentException
- public PathByID(Graph<V,? extends Edge> graph, java.lang.Integer[] path) throws java.lang.IllegalArgumentException
graph
- the graph its vertices can be part of this pathpath
- the predefined path or null
java.lang.IllegalArgumentException
- public PathByID(Graph<V,? extends Edge> graph, java.util.List<java.lang.Integer> path) throws java.lang.IllegalArgumentException
graph
- the graph its vertices can be part of this pathpath
- the predefined path or null
java.lang.IllegalArgumentException
- public void add(int vertexID) throws java.lang.UnsupportedOperationException, java.lang.IllegalArgumentException
add
in class WalkByID<V extends Vertex>
vertexID
- the id of the vertexjava.lang.UnsupportedOperationException
- WalkByID.setGraph(Graph)
)java.lang.IllegalArgumentException
- PathByID
)public void removeLast() throws java.lang.UnsupportedOperationException
removeLast
in class WalkByID<V extends Vertex>
java.lang.UnsupportedOperationException
- WalkByID.setGraph(Graph)
)public boolean isClosed()
public Path<V> cast() throws java.lang.UnsupportedOperationException, java.lang.IllegalArgumentException
cast
in class WalkByID<V extends Vertex>
java.lang.UnsupportedOperationException
- WalkByID.setGraph(Graph)
)java.lang.IllegalArgumentException
- public boolean equals(java.lang.Object o)
public PathByID<V> clone()