Firstly, I'm not very good at exact graph terminologies.
I am given a graph as an adjacency matrix (it is undirected, unweighted and can be disconnected). I have to find total number of possible linear paths in the graph, i.e., in each path, edges should be unique. No two paths should have the same set of edges. Also vertices should not repeat in a path. I can't figure out the exact terminology for it.
Ex: for 5 vertices A,B,C,D,E: adjacency matrix is
A B C D E A 0 1 1 0 0 B 1 0 1 0 1 C 1 1 0 0 0 D 0 0 0 0 0 E 0 1 0 0 0
Therefore the possible linear paths are:
- A->B
- A->C
- B->C
- B->E
- A->B->C
- A->B->E
- A->C->B->E
Thus total number of paths = 7. I only have to find total no. of such paths. I need to write a code for it. How can I write it optimally. The no. of vertices can be at max 50.