Reputation: 65
I want to find the number of different possible paths of a fixed-length "K" between two vertices of an undirected graph, I saw many implementations of it using the Adjacency matrix but is there any way to do it without an adjacency matrix? If there is a way, please give some hint.
Upvotes: 0
Views: 264
Reputation: 100
For this problem I think that adjacency matrices are your best bet as you can compute many answers at the same time making the overall algorithm faster. If you want to implement a solution using an adjacency list I would try a brute force-recursive approach but do note that it will definitely be slower than the adjacency matrix one.
Upvotes: 1