On an undirected and unweighted graph, how is it possible to enumerate all the groups of connected nodes having a length of 1,2,..,n (n is a user defined value)?
This question is similar to this one; with this difference: for n=3; I also require to find the path: A-B-C and C-E-F.
If n is 4, then the paths should also include:
A-B-C-D
A-B-C-E
A-B-C-F
A-C-E-F
I guess this is a problem of something like; "all pairs - all paths", where each path can contain at most n nodes. Would you also please tell the methods computational complexity?
My thinking is that I need to use both DFS and BFS simultaneously, but I am not sure whether this is efficient?