|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.combean.graph.alg.AbstractGraphAlg net.sourceforge.combean.graph.alg.spath.AbstractLabellingAlg<NumType>
public abstract class AbstractLabellingAlg<NumType extends Comparable<NumType>>
Abstract base path for label setting or label correcting shortest path algorithms.
Field Summary | |
---|---|
protected PathAlgebra<NumType> |
algebra
|
protected NodeMap<NumType> |
distance
|
protected FixedEdgeMap<NumType> |
edgeWeights
|
protected OutgoingEdgeNeighborhoodGraphProp |
neigh
|
protected NodeMap<Edge> |
pred
|
protected Node |
startNode
|
Constructor Summary | |
---|---|
AbstractLabellingAlg()
constructor |
Method Summary | |
---|---|
protected abstract void |
calcShortestPaths()
A template method which contains the actual algorithm for calculating the shortest paths. |
protected boolean |
correctLabel(Node v,
Edge e)
Elementary correction of one label. |
boolean |
getCalcLengthOnly()
Return the value of the flag which enables/disables the calculation of the actual paths. |
NodeMap<NumType> |
getDistanceMap()
Return a NodeMap which contains the shortest distance to the source for every node (or infinity if the node is not reachable from the source). |
NumType |
getDistanceTo(Node t)
Return the shortest path distance to a given node (may only be called after the algorithm has been run). |
NodeMap<Edge> |
getPredecessorMap()
Return a NodeMap which maps every node in the graph to its predecessor (or null if no precedessor exists, e.g. for the source or because the node has not been reached by the shortest path algorithm). |
FixedPath |
getShortestPathTo(Node t)
Return the shortest path to a given node (may only be called after the algorithm has been run) |
protected void |
init()
Internal helper method which initializes the collaborators of the algorithm with sensible default values if they have not explicitly been set. |
void |
run()
Execute the algorithm. |
void |
setAlgebra(PathAlgebra<NumType> algebra)
Define the operations which are used to calculate the distance of a node to the source. |
void |
setCalcLengthOnly(boolean calcLengthOnly)
Enable/disable the calculation of the actual paths. |
void |
setEdgeWeightMap(FixedEdgeMap<NumType> edgeWeights)
Set the weights of the edges of the graph. |
void |
setSource(Node s)
Define the source of the shortest paths. |
Methods inherited from class net.sourceforge.combean.graph.alg.AbstractGraphAlg |
---|
getGraph, setGraph |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface net.sourceforge.combean.interfaces.graph.alg.GraphAlgorithm |
---|
getGraph, setGraph |
Field Detail |
---|
protected OutgoingEdgeNeighborhoodGraphProp neigh
protected PathAlgebra<NumType extends Comparable<NumType>> algebra
protected Node startNode
protected FixedEdgeMap<NumType extends Comparable<NumType>> edgeWeights
protected NodeMap<NumType extends Comparable<NumType>> distance
protected NodeMap<Edge> pred
Constructor Detail |
---|
public AbstractLabellingAlg()
Method Detail |
---|
public final void setSource(Node s)
SingleSourceShortestPathAlg
setSource
in interface SingleSourceShortestPathAlg<NumType extends Comparable<NumType>>
public final boolean getCalcLengthOnly()
ShortestPathAlg
getCalcLengthOnly
in interface ShortestPathAlg<NumType extends Comparable<NumType>>
public final void setAlgebra(PathAlgebra<NumType> algebra)
ShortestPathAlg
setAlgebra
in interface ShortestPathAlg<NumType extends Comparable<NumType>>
algebra
- the path algebra containing the required operationspublic final void setCalcLengthOnly(boolean calcLengthOnly)
ShortestPathAlg
setCalcLengthOnly
in interface ShortestPathAlg<NumType extends Comparable<NumType>>
calcLengthOnly
- the new value of the calcLengthOnly flag.public final void setEdgeWeightMap(FixedEdgeMap<NumType> edgeWeights)
ShortestPathAlg
setEdgeWeightMap
in interface ShortestPathAlg<NumType extends Comparable<NumType>>
edgeWeights
- the map of the weights of the edges in the graph.public final NodeMap<NumType> getDistanceMap()
SingleSourceShortestPathAlg
getDistanceMap
in interface SingleSourceShortestPathAlg<NumType extends Comparable<NumType>>
public final NodeMap<Edge> getPredecessorMap()
SingleSourceShortestPathAlg
getPredecessorMap
in interface SingleSourceShortestPathAlg<NumType extends Comparable<NumType>>
public final NumType getDistanceTo(Node t)
SingleSourceShortestPathAlg
getDistanceTo
in interface SingleSourceShortestPathAlg<NumType extends Comparable<NumType>>
t
- the node to which the shortest path distance shall be given.
public final FixedPath getShortestPathTo(Node t)
SingleSourceShortestPathAlg
getShortestPathTo
in interface SingleSourceShortestPathAlg<NumType extends Comparable<NumType>>
t
- the node to which the shortest path shall be given
protected abstract void calcShortestPaths()
public final void run()
GraphAlgorithm
run
in interface GraphAlgorithm
protected void init()
protected boolean correctLabel(Node v, Edge e)
v
- the source node of ee
- the edge from v to the node where the label shall be corrected
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |