org.neo4j.graphalgo
Interface CostAccumulator<T>

Type Parameters:
T - The data type the edge weights are represented by.

public interface CostAccumulator<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

Method Summary
 T addCosts(T c1, T c2)
          This is the accumulating method.
 

Method Detail

addCosts

T addCosts(T c1,
           T c2)
This is the accumulating method. This should return the results of "adding" two path costs with each other.

Parameters:
c1 - One of the costs.
c2 - The other cost.
Returns:
The resulting cost.


Copyright © 2012 The Neo4j Graph Database Project. All Rights Reserved.