Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions app/models/busstop_node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ def self.allUnvisitedNode
end

def self.findRoute(startID,endID)
allRoutesFound = Array.new
if not (Route.all.count > 0)
puts "No Routes Exist."
return false;
Expand Down Expand Up @@ -197,7 +198,9 @@ def self.findRoute(startID,endID)
print "#{currentNode.to_yaml}"
print "Algo complete"
@@graph = []
return pathRoute
allRoutesFound << pathRoute
pathRoute.pop
currentNode = pathRoute.pop
end
unVisitedNodes = self.allUnvisitedNode
shortestDistance = 999999999999999
Expand Down Expand Up @@ -231,7 +234,7 @@ def self.findRoute(startID,endID)
"\n\n\n"
else currentNode == nil
puts "end of algo. Reached Back to sourceNode."
return false #end of algo. Reached Back to sourceNode. ###Should Return pathRoute.###
return allRoutesFound #end of algo. Reached Back to sourceNode. ###Should Return pathRoute.###
end
end
#remove this if condition in future.
Expand Down