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.
- Author:
- Patrik Larsson
getCost
T getCost(Relationship relationship,
Direction direction)
- 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
- direction
- The direction in which the relationship is being
evaluated, either Direction.INCOMING
or
Direction.OUTGOING
.
- Returns:
- The cost for this edge/relationship
Copyright © 2011 The Neo4j Graph Database Project. All Rights Reserved.