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
19 def initialize(graph)
20   super(graph)
21 
22   # by default, through an exception if a negative-weight cycle is detected
23   @edge_not_minimized_event_handler = lambda do |u, v|
24     raise ArgumentError.new("there is a negative-weight cycle including edge (#{u}, #{v})")
25   end
26 end