class RGL::BellmanFordVisitor

Bellman-Ford shortest paths algorithm has the following event points:

* examine_edge
* edge_relaxed
* edge_not_relaxed
* edge_minimized
* edge_not_minimized

Public Class Methods

new(graph) click to toggle source
Calls superclass method
# File lib/rgl/bellman_ford.rb, line 21
def initialize(graph)
  super(graph)

  # by default, through an exception if a negative-weight cycle is detected
  @edge_not_minimized_event_handler = lambda do |u, v|
    raise ArgumentError.new("there is a negative-weight cycle including edge (#{u}, #{v})")
  end
end