Class: Dijkstra::Path
- Inherits:
-
Object
- Object
- Dijkstra::Path
- Defined in:
- lib/dijkstra_trace.rb
Overview
The resulting shortest path will be an object of the Path class
Instance Attribute Summary collapse
-
#distance ⇒ Object
Returns the value of attribute distance.
-
#ending_point ⇒ Object
Returns the value of attribute ending_point.
-
#path ⇒ Object
Returns the value of attribute path.
-
#starting_point ⇒ Object
Returns the value of attribute starting_point.
Instance Method Summary collapse
-
#initialize(source, destination) ⇒ Path
constructor
Distance variable stores the total distance of the path Path array has the vertices connecting the shortest path Starting point, ending point are used to get the source and destination of the resulting path if needed.
Constructor Details
#initialize(source, destination) ⇒ Path
Distance variable stores the total distance of the path Path array has the vertices connecting the shortest path Starting point, ending point are used to get the source and destination of the resulting path if needed
10 11 12 13 14 15 |
# File 'lib/dijkstra_trace.rb', line 10 def initialize(source, destination) @starting_point = source @ending_point = destination @distance = 0 @path = [] end |
Instance Attribute Details
#distance ⇒ Object
Returns the value of attribute distance.
5 6 7 |
# File 'lib/dijkstra_trace.rb', line 5 def distance @distance end |
#ending_point ⇒ Object
Returns the value of attribute ending_point.
5 6 7 |
# File 'lib/dijkstra_trace.rb', line 5 def ending_point @ending_point end |
#path ⇒ Object
Returns the value of attribute path.
5 6 7 |
# File 'lib/dijkstra_trace.rb', line 5 def path @path end |
#starting_point ⇒ Object
Returns the value of attribute starting_point.
5 6 7 |
# File 'lib/dijkstra_trace.rb', line 5 def starting_point @starting_point end |