-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple rotues algo #4
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
|
@@ -194,10 +195,15 @@ def self.findRoute(startID,endID) | |
while true | ||
#break and retrun `pathRoute` if we have reached the destinationNode. | ||
if currentNode.id == destNode.id | ||
currentNode.visited = false #we might arrive on this through a different route. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. [83/80] |
||
print "#{currentNode.to_yaml}" | ||
print "Algo complete" | ||
@@graph = [] | ||
return pathRoute | ||
newPathFound = Array.new | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tab detected. |
||
newPathFound = pathRoute.map(&:dup) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tab detected. |
||
allRoutesFound << newPathFound | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tab detected. |
||
#set the current node to go to. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing space after #. |
||
#Required. Please Implement before calling this method. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing space after #. |
||
raise "Method Imcomplete." | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tab detected. |
||
end | ||
unVisitedNodes = self.allUnvisitedNode | ||
shortestDistance = 999999999999999 | ||
|
@@ -231,7 +237,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.### | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Line is too long. [101/80] |
||
end | ||
end | ||
#remove this if condition in future. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use 2 (not 1) spaces for indentation.
Tab detected.
Use snake_case for variable names.