class MiniGraph::Core::Search::Base


Base Search Implementation


Attributes

graph[R]
vertex_index[R]

Public Class Methods

new(graph, vertex_index) click to toggle source
# File lib/mini_graph/core/search.rb, line 14
def initialize(graph, vertex_index)
  @graph        = graph
  @vertex_index = vertex_index
end

Public Instance Methods

each() { |graph| ... } click to toggle source
# File lib/mini_graph/core/search.rb, line 19
def each
  return enum_for(:each) unless block_given?

  visit(vertex_index) do |vi|
    yield graph[vi]
  end
end
visit(index, visited=Array.new(graph.size, false), &block) click to toggle source
# File lib/mini_graph/core/search.rb, line 27
def visit(index, visited=Array.new(graph.size, false), &block)
  raise NotImplementedError, "#visit must be implemented"
end