Class: Aquanaut::Node Abstract
- Inherits:
-
Object
- Object
- Aquanaut::Node
- Defined in:
- lib/aquanaut/node.rb
Overview
This class is abstract.
Base node class which needs to be inherited for special cases.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#adjacency_list ⇒ Object
readonly
Returns the value of attribute adjacency_list.
Instance Method Summary collapse
-
#add_edge(successor) ⇒ Object
Implements adjacency with an adjacency list.
-
#initialize ⇒ Node
constructor
A new instance of Node.
Constructor Details
#initialize ⇒ Node
Returns a new instance of Node.
11 12 13 |
# File 'lib/aquanaut/node.rb', line 11 def initialize() @adjacency_list = [] end |
Instance Attribute Details
#adjacency_list ⇒ Object (readonly)
Returns the value of attribute adjacency_list.
9 10 11 |
# File 'lib/aquanaut/node.rb', line 9 def adjacency_list @adjacency_list end |
Instance Method Details
#add_edge(successor) ⇒ Object
Implements adjacency with an adjacency list.
17 18 19 |
# File 'lib/aquanaut/node.rb', line 17 def add_edge(successor) @adjacency_list << successor end |