Class ShortestPathResult
- java.lang.Object
-
- org.planit.algorithms.shortestpath.ShortestPathResult
-
public class ShortestPathResult extends Object
Class that stores the result of a shortest path execution allowing one to extract paths or cost information Note that we must traverse a path from an origin to a destination in reversed order to extract the path- Author:
- markr
-
-
Field Summary
Fields Modifier and Type Field Description protected EdgeSegment[]
incomingEdgeSegment
the preceding vertex to reach the vertex with the given measured costprotected double[]
vertexMeasuredCost
the costs found by a shortest path run
-
Constructor Summary
Constructors Modifier Constructor Description protected
ShortestPathResult(double[] vertexMeasuredCost, EdgeSegment[] incomingEdgeSegment)
Constructor only to be used by shortest path algorithms
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Path
createPath(IdGroupingToken groupId, Vertex origin, Vertex destination)
Create the path from the provided origin to a specified destination vertex, using the results available.double
getCostToReach(Vertex vertex)
Collect the cost to reach the given vertexEdgeSegment
getIncomingEdgeSegmentForVertex(Vertex vertex)
Find the incoming edge segment for a given vertex
-
-
-
Field Detail
-
vertexMeasuredCost
protected final double[] vertexMeasuredCost
the costs found by a shortest path run
-
incomingEdgeSegment
protected final EdgeSegment[] incomingEdgeSegment
the preceding vertex to reach the vertex with the given measured cost
-
-
Constructor Detail
-
ShortestPathResult
protected ShortestPathResult(double[] vertexMeasuredCost, EdgeSegment[] incomingEdgeSegment)
Constructor only to be used by shortest path algorithms- Parameters:
vertexMeasuredCost
- measured costs to get to the vertex (by id)incomingEdgeSegment
- the incoming edge segment for each vertex (by id)
-
-
Method Detail
-
createPath
public Path createPath(IdGroupingToken groupId, Vertex origin, Vertex destination)
Create the path from the provided origin to a specified destination vertex, using the results available.- Parameters:
groupId
- contiguous id generation within this group for instances for pathsorigin
- the specified origin vertexdestination
- the specified destination vertex- Returns:
- the path that is created, when no path could be extracted null is returned
-
getIncomingEdgeSegmentForVertex
public EdgeSegment getIncomingEdgeSegmentForVertex(Vertex vertex)
Find the incoming edge segment for a given vertex- Parameters:
vertex
- to get incoming segment for- Returns:
- incoming edge segment
-
getCostToReach
public double getCostToReach(Vertex vertex)
Collect the cost to reach the given vertex- Parameters:
vertex
- to collect cost for- Returns:
- cost found
-
-