Class: Doodl::DepthFirstSearch
- Inherits:
-
Object
- Object
- Doodl::DepthFirstSearch
- Defined in:
- lib/depth_first_search.rb
Instance Attribute Summary collapse
-
#dist ⇒ Object
readonly
Returns the value of attribute dist.
-
#list ⇒ Object
readonly
Returns the value of attribute list.
-
#prev ⇒ Object
readonly
Returns the value of attribute prev.
Instance Method Summary collapse
-
#initialize(graph, start_node = nil, visitor = nil, radius = nil) ⇒ DepthFirstSearch
constructor
A new instance of DepthFirstSearch.
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
#dist ⇒ Object (readonly)
Returns the value of attribute dist.
7 8 9 |
# File 'lib/depth_first_search.rb', line 7 def dist @dist end |
#list ⇒ Object (readonly)
Returns the value of attribute list.
7 8 9 |
# File 'lib/depth_first_search.rb', line 7 def list @list end |
#prev ⇒ Object (readonly)
Returns the value of attribute prev.
7 8 9 |
# File 'lib/depth_first_search.rb', line 7 def prev @prev end |