anfjnlnl
anfjnlnl

Reputation: 65

Number of possible paths of fixed length 'K' between given vertices of an undirected graph

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

Answers (1)

dawooshifingerhold
dawooshifingerhold

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

Related Questions