E
- Edge typepublic static class GraphUtils.GraphPath<E> extends Object implements Comparable<GraphUtils.GraphPath>
Class to represent a path in a Graph. Note that a path is defined in terms of edges (rather than vertices) so that multiple edges between the same pair of vertices can be discriminated.
It implements the {@link java.lang.Comparable Comparable}
interface to impose order between different paths. First, try to order using the path weight, and if equals, using the number of hops.
Constructor and Description |
---|
GraphUtils.GraphPath(List<E> path,
double pathWeight)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(GraphUtils.GraphPath o)
Compares this object with the specified object for order.
|
boolean |
equals(Object o)
Indicates whether some other object is "equal to" this one.
|
List<E> |
getPath()
Returns the edges making up the path.
|
int |
getPathLength()
Returns the path length measured in number of hops or edges.
|
double |
getPathWeight()
Returns the weight assigned to the path.
|
int |
hashCode()
Returns a hash code value for the object.
|
public GraphUtils.GraphPath(List<E> path, double pathWeight)
path
- Sequence of linkspathWeight
- Path weightpublic int compareTo(GraphUtils.GraphPath o)
compareTo
in interface Comparable<GraphUtils.GraphPath>
o
- The object to be comparedpublic boolean equals(Object o)
equals
in class Object
o
- Reference object with which to comparetrue
if this object is the same as the o
argument; false
otherwisepublic List<E> getPath()
public int getPathLength()
{@link #getPath getPath()}.size()
.public double getPathWeight()
public int hashCode()
HashMap
.hashCode
in class Object