class NetworkX::CurrentEdge
Helper class for preflow push algorithm
Attributes
curr[R]
edges[R]
Public Class Methods
new(edges)
click to toggle source
# File lib/networkx/flow/utils.rb, line 6 def initialize(edges) @edges = edges @index = {} @n = edges.length @curr = 0 edges.each_with_index { |(key, _value), idx| @index[idx] = key } end
Public Instance Methods
get()
click to toggle source
# File lib/networkx/flow/utils.rb, line 14 def get [@index[@curr], @edges[@index[@curr]]] end
move_to_next()
click to toggle source
# File lib/networkx/flow/utils.rb, line 18 def move_to_next @temp = @curr @curr = (@curr + 1) % @n raise StopIteration if @temp == @n - 1 end