class NetworkX::GlobalRelabelThreshold

Helper class for preflow push algorithm

Public Class Methods

new(num_1, num_2, freq) click to toggle source
# File lib/networkx/flow/utils.rb, line 37
def initialize(num_1, num_2, freq)
  freq = freq.nil? ? Float::INFINITY : freq
  @threshold = (num_1 + num_2) / freq
  @work = 0
end

Public Instance Methods

add_work(work) click to toggle source
# File lib/networkx/flow/utils.rb, line 43
def add_work(work)
  @work += work
end
clear_work() click to toggle source
# File lib/networkx/flow/utils.rb, line 51
def clear_work
  @work = 0
end
reached?() click to toggle source
# File lib/networkx/flow/utils.rb, line 47
def reached?
  @work >= @threshold
end