Package org.neo4j.graphalgo
Interface CostEvaluator<T>
- Type Parameters:
T
- The data type the edge weights are represented by.
public interface CostEvaluator<T>
In order to make the solving of shortest path problems as general as
possible, the algorithms accept objects handling all relevant tasks regarding
costs of paths. This allows the user to represent the costs in any possible
way, and to calculate them in any way. The usual case is numbers that we just
add together, but what if we have for example factors we would like to
multiply instead? This is handled by this system, which works as follows. A
CostEvaluator is used to get the cost for a single relationship. These costs
are then added through a CostAccumulator. Costs for alternative paths are
compared with a common java.util.Comparator.
-
Method Summary
Modifier and TypeMethodDescriptiongetCost
(Relationship relationship, Direction direction) This is the general method for looking up costs for relationships.
-
Method Details
-
getCost
This is the general method for looking up costs for relationships. This can do anything, like looking up a property or running some small calculation.- Parameters:
relationship
- the relationship to get the cost fordirection
- The direction in which the relationship is being evaluated, eitherDirection.INCOMING
orDirection.OUTGOING
.- Returns:
- The cost for this edge/relationship
-