posted 1 year ago
Hello, I am using the recursive method below in a program to find all the non-looping paths between two vertices in a directed graph. Currently, the stopping case is when the current vertex is equal to the destination vertex. It works fine when finding all the paths between two different vertices, but obviously doesn't work when looking for the paths between a vertex and itself. I was wondering if anyone might have some advice on how to modify the method below to allow the method to find all the paths between a vertex and itself in a cyclic graph without repeating any vertices except the starting and ending vertex (for example 1-2-3-1 would be okay but not 1-3-1-3-4-1). I am still having quite a difficult time with recursion so any tips you might have would be much appreciated.