** Edit: I just noticed my current algorithm is incorrect, as it only finds paths starting/ending at the given node. I'm trying to figure out a solution, but I'm a bit stuck.
Say I have an undirected graph. I would like to find all possible combinations of nodes that could be connected with a single path, that include a certain node.
--clarification: That is paths starting and ending at any node. Not just paths starting at the node in question.
Take this graph for example:
A----B
| |
| |
D----C
The solution for node A would be:
ABCD; example path A->B->C->D. Alternatively B->A->C->D or many others. As long as we have one, we're good.
ABC; example path C->B->A, etc.
ADC
AB
AD
A; 'path' from itself to itself
I understand this is a -very- hard problem with a lot of results. To make it simpler it is allowed to have some duplicates in the end result, but less would be better(this makes cyclic graphs a bit easier).
My current(naive) solution is as follows:
- Start at the node in question
- Note current path as possible path.
- If no possible connections, return.
- For each possible connection, go into recursion via [2].
See the following example. The problem with my algorithm is that a lot of duplicates are generated. Here the bottom two items in the example tree are the same solution.

You state this procedure is a part of a bigger algorithm. Could you perhaps say what that algorithm is or what the actual problem is you're trying to solve? It could be the case that there is a more efficient algorithm for your actual problem that doesn't use this subroutine, so this can be very relevant!
– Discrete lizard Feb 13 '18 at 13:06