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