class DFS

Public Class Methods

new(options) click to toggle source
# File lib/rsearch/dfs.rb, line 5
def initialize(options)

  stack = []
  marked = Set.new
  marked << options[:start]

  scheduler = Proc.new do |states|
    states.reverse.each do |state|
      stack << state if !marked.include?(state)
      marked << state
    end
    stack.pop
  end

  @search = Search.new(start: options[:start],
                       generator: options[:generator],
                       scheduler: scheduler)
end

Public Instance Methods

method_missing(meth, *args, &block) click to toggle source
# File lib/rsearch/dfs.rb, line 24
def method_missing(meth, *args, &block)
  @search.send(meth, *args, &block)
end