class CycleDetector
Detects cycles between nodes
Public Class Methods
new(links)
click to toggle source
# File lib/cpp_dependency_graph/cycle_detector.rb, line 7 def initialize(links) @cyclic_links = links.flat_map do |source, source_links| source_links.select { |target| links[target].include?(source) }.map do |target| [CyclicLink.new(source, target), true] end end.to_h end
Public Instance Methods
cyclic?(source, target)
click to toggle source
# File lib/cpp_dependency_graph/cycle_detector.rb, line 15 def cyclic?(source, target) k = CyclicLink.new(source, target) @cyclic_links.key?(k) end
to_s()
click to toggle source
# File lib/cpp_dependency_graph/cycle_detector.rb, line 20 def to_s @cyclic_links.keys end