Skip to content
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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
12 changes: 9 additions & 3 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

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.

if not (Route.all.count > 0)
puts "No Routes Exist."
return false;
Expand Down Expand Up @@ -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.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [83/80]
Use 2 (not 1) spaces for indentation.
Missing space after #.
Tab detected.

print "#{currentNode.to_yaml}"
print "Algo complete"
@@graph = []
return pathRoute
newPathFound = Array.new

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tab detected.
Use snake_case for variable names.

newPathFound = pathRoute.map(&:dup)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tab detected.
Use snake_case for variable names.

allRoutesFound << newPathFound

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tab detected.

#set the current node to go to.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing space after #.
Tab detected.

#Required. Please Implement before calling this method.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing space after #.
Tab detected.

raise "Method Imcomplete."

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tab detected.

end
unVisitedNodes = self.allUnvisitedNode
shortestDistance = 999999999999999
Expand Down Expand Up @@ -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.###

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long. [101/80]
Unnecessary spacing detected.
Inconsistent indentation detected.
Missing space after #.
Tab detected.

end
end
#remove this if condition in future.
Expand Down