Module: Neo4jr::PathRater

Defined in:
lib/neo4jr/path_rater.rb

Instance Method Summary collapse

Instance Method Details

#get_cost(path, start_cost, cost_evaluator, cost_accumulator) ⇒ Object



3
4
5
6
7
8
9
10
11
# File 'lib/neo4jr/path_rater.rb', line 3

def get_cost path, start_cost, cost_evaluator, cost_accumulator
  cost = start_cost
  previous = nil
  path.each do |r|
    cost = cost_accumulator.addCosts(cost, cost_evaluator.getCost(r, r.getEndNode == previous)) if r.kind_of? org.neo4j.graphdb.Relationship
    previous = r
  end
  cost
end