class RGL::BipartiteBFSIterator
Attributes
Public Instance Methods
Source
# File lib/rgl/bipartite.rb 71 def handle_back_edge(u, v) 72 verify_odd_cycle(u, v) 73 end
Source
# File lib/rgl/bipartite.rb 75 def handle_forward_edge(u, v) 76 verify_odd_cycle(u, v) 77 end
Source
# File lib/rgl/bipartite.rb 67 def handle_tree_edge(u, v) 68 @bipartite_sets_map[v] = (@bipartite_sets_map[u] + 1) % 2 unless u.nil? # put v into the other set 69 end
Source
# File lib/rgl/bipartite.rb 49 def reset 50 super 51 52 @bipartite_sets_map = {} 53 @found_odd_cycle = false 54 end
Calls superclass method
Source
# File lib/rgl/bipartite.rb 62 def reset_start(new_start) 63 @start_vertex = new_start 64 set_to_begin 65 end
Source
# File lib/rgl/bipartite.rb 56 def set_to_begin 57 super 58 59 @bipartite_sets_map[@start_vertex] = 0 60 end
Calls superclass method
Private Instance Methods
Source
# File lib/rgl/bipartite.rb 81 def verify_odd_cycle(u, v) 82 u_set = @bipartite_sets_map[u] 83 @found_odd_cycle = true if u_set && u_set == @bipartite_sets_map[v] 84 end