Class: Doodl::DepthFirstSearch

Inherits:
Object
  • Object
show all
Defined in:
lib/depth_first_search.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(graph, start_node = nil, visitor = nil, radius = nil) ⇒ DepthFirstSearch

Returns a new instance of DepthFirstSearch.



9
10
11
12
13
14
15
16
# File 'lib/depth_first_search.rb', line 9

def initialize(graph, start_node = nil, visitor = nil, radius = nil)
  @graph, @start_node, @visitor, @radius = graph, start_node, visitor, radius
  @color, @prev, @dist = {}, {}, {}
  @time = 0
  @list = []
  init_maps
  main_algorithm
end

Instance Attribute Details

#distObject (readonly)

Returns the value of attribute dist.



7
8
9
# File 'lib/depth_first_search.rb', line 7

def dist
  @dist
end

#listObject (readonly)

Returns the value of attribute list.



7
8
9
# File 'lib/depth_first_search.rb', line 7

def list
  @list
end

#prevObject (readonly)

Returns the value of attribute prev.



7
8
9
# File 'lib/depth_first_search.rb', line 7

def prev
  @prev
end