Package oracle.pgx.api
Class PgxPath<ID>
- java.lang.Object
-
- oracle.pgx.api.internal.ApiObject
-
- oracle.pgx.api.Destroyable
-
- oracle.pgx.api.PgxPath<ID>
-
- Type Parameters:
ID
- the vertex ID type
- All Implemented Interfaces:
java.lang.AutoCloseable
public class PgxPath<ID> extends Destroyable
A path from a source to a destination vertex in aPgxGraph
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
PgxPath.PathIterable<E>
static class
PgxPath.PathIterator<E>
A read-onlyListIterator
with an additionalPgxPath.PathIterator.reset()
method to start over iteration.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PgxFuture<java.lang.Void>
destroyAsync()
Requests destruction of this object.boolean
equals(java.lang.Object obj)
boolean
exists()
Checks whether a path exists.PgxVertex<ID>
getDestination()
Gets the destination vertex.PgxPath.PathIterable<PgxEdge>
getEdges()
Gets the edges of this path.PgxGraph
getGraph()
Gets the PgxGraph the Path is defined on.double
getPathLengthWithCost()
Gets the path cost Note: for hop-based algorithms, this method returnsgetPathLengthWithHop()
as double.long
getPathLengthWithHop()
Gets the path length in hops.PgxVertex<ID>
getSource()
Gets the source vertex.PgxPath.PathIterable<PgxVertex<ID>>
getVertices()
Gets the vertices of this path.int
hashCode()
java.lang.String
toString()
-
Methods inherited from class oracle.pgx.api.Destroyable
close, destroy
-
-
-
-
Method Detail
-
getGraph
public PgxGraph getGraph()
Gets the PgxGraph the Path is defined on.- Returns:
- the graph
-
exists
public boolean exists()
Checks whether a path exists.- Returns:
- true, if exists
-
getPathLengthWithHop
public long getPathLengthWithHop()
Gets the path length in hops.- Returns:
- number of edges in this path (zero if path doesn't exist)
-
getPathLengthWithCost
public double getPathLengthWithCost()
Gets the path cost Note: for hop-based algorithms, this method returnsgetPathLengthWithHop()
as double.- Returns:
- total cost of this path (zero if path doesn't exist). The returned value equals the sum of the edge costs
-
getDestination
public PgxVertex<ID> getDestination()
Gets the destination vertex.- Returns:
- destination vertex
-
getVertices
public PgxPath.PathIterable<PgxVertex<ID>> getVertices()
Gets the vertices of this path.- Returns:
- vertices iterable
-
getEdges
public PgxPath.PathIterable<PgxEdge> getEdges()
Gets the edges of this path.- Returns:
- edges iterable
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
destroyAsync
public PgxFuture<java.lang.Void> destroyAsync()
Description copied from class:Destroyable
Requests destruction of this object. After this method returns, the behavior of any method of this class becomes undefined.- Specified by:
destroyAsync
in classDestroyable
- Returns:
- a future which will be completed once the destruction request finishes.
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-