class Dependy::Operations::CycleFinder

Attributes

graph[R]

Public Class Methods

new(graph = {}) click to toggle source
# File lib/dependy/operations/cycle_finder.rb, line 6
def initialize(graph = {})
  @graph = graph
end

Public Instance Methods

cycles() click to toggle source
# File lib/dependy/operations/cycle_finder.rb, line 10
def cycles
  strongly_connected_components.select { |scc| scc.count > 1 }
end

Private Instance Methods

tsort_each_child(node_name, &block) click to toggle source
# File lib/dependy/operations/cycle_finder.rb, line 22
def tsort_each_child(node_name, &block)
  graph.children_for(node_name).each(&block)
end
tsort_each_node(&block) click to toggle source
# File lib/dependy/operations/cycle_finder.rb, line 18
def tsort_each_node(&block)
  graph.each_key(&block)
end