
In above directed graph ,each node represent a town . Each node is represent by a object . In each node object there is a array called adjacent_nodes which contains the child/adjacent nodes of each node . like this

There is method called find_paths (its an class method) and it is expected to return no of paths b/w any to points x and y . In our case we are finding no_of_paths b/w node A to C .
Node.find_paths('A','C') #app.rb line 40
code for function find_paths
#find count of how many paths there exists
#for any given point X and Y
#node.rb
`
def self.find_paths(source,terminal)
p "----------#{source}---#{@@count}---------------"
root = Node.get_obeject(source)
p root
p "obect catched.."
#p root
if root == nil or source == terminal
p " path terinated..."
has_child = false
else
p "has child..."
child_stack = root.children
p child_stack
has_child = true
end
if source == terminal
p "source equals to terminal , incrementing..."
@@count += 1
end
if has_child
loop do
child = child_stack.pop
#p "loop for child #{child}----"
if child != nil
Node.find_paths(child , terminal)
else
break
end
end
end
"no of paths b/w #{source} to #{terminal} = #{@@count}"
end
`
Now bug is that when ever we traversing for node A to C

at level L2 it is failing at node E and then node B because in line 137 in node.rb we fetching object of E and in this object adjacent_nodes array is empty mean magically childs for node E are vanished from array and the traversing halted due to this , similar issue with node B . Look below object we getting for E and B

since there is no child for node E and node B ,we couldn't traverse and due to this it shows possible path b/w A to C is 2 routes .. but expected output is 4 routes
NOTE : find_paths method uses two methods get_object to get object of any node and find_value for getting name of node .
Ruby version 2.6.3 running on windows x86 machine
In above directed graph ,each node represent a town . Each node is represent by a object . In each node object there is a array called adjacent_nodes which contains the child/adjacent nodes of each node . like this

There is method called find_paths (its an class method) and it is expected to return no of paths b/w any to points x and y . In our case we are finding no_of_paths b/w node A to C .
Node.find_paths('A','C') #app.rb line 40code for function find_paths
#find count of how many paths there exists
#for any given point X and Y
#node.rb
`
def self.find_paths(source,terminal)
end

`
Now bug is that when ever we traversing for node A to C
at level L2 it is failing at node E and then node B because in line 137 in node.rb we fetching object of E and in this object adjacent_nodes array is empty mean magically childs for node E are vanished from array and the traversing halted due to this , similar issue with node B . Look below object we getting for E and B

since there is no child for node E and node B ,we couldn't traverse and due to this it shows possible path b/w A to C is 2 routes .. but expected output is 4 routes
NOTE : find_paths method uses two methods get_object to get object of any node and find_value for getting name of node .
Ruby version 2.6.3 running on windows x86 machine