lib/bio/pathway.rb in bio-1.4.3.0001 vs lib/bio/pathway.rb in bio-1.5.0
- old
+ new
@@ -589,10 +589,10 @@
# Bellman-Ford method for solving the single-source shortest-paths
# problem in the graph in which edge weights can be negative.
def bellman_ford(root)
distance, predecessor = initialize_single_source(root)
- for i in 1 ..(self.nodes - 1) do
+ (self.nodes - 1).times do
@graph.each_key do |u|
@graph[u].each do |v, w|
# relaxing procedure of root -> 'u' -> 'v'
if distance[v] > distance[u] + w
distance[v] = distance[u] + w