A adjacency matrix presents connections between nodes in a arbitrary tree.
Here is a instance of adjacency matrix which presents a undirected graph:
1 2 3 4 1 0 1 1 0 2 1 0 1 0 3 1 1 0 0 4 0 0 0 0
This matrix presents a graph where nodes 1 and 2 are connected, 1 and 3 are connected, 2 and 3 are connected.
How to bruteforce all combinations of possible paths in such a graph using this kind of matrix? I mean that picking just node 1 is a separate combination. Then, say, 1-2 is a separate combination. 1-2-3; 3-1-2. But 1-2-3-1 is not possible, because of double picking the same node.
So how to bruteforce all combinations using these rules?
I prefer C#, C++ or Java language samples)