igraph-help
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [igraph] All possible path between two nodes


From: Tamás Nepusz
Subject: Re: [igraph] All possible path between two nodes
Date: Mon, 25 Nov 2013 10:58:01 +0100

I had to terminate because my graph might have cycles. I don't need all possible path. I just need a path that's longer the immediate path between two nodes if it exists. 

For instance:

If A->B and 
also A->C->B or A->D->B

I need to see those two paths.
The easiest is probably to temporarily remove the A-B edge from your graph and try the shortest path search again.

An alternative is to use a k-shortest-paths algorithm with some low k. Someone else has already ported Yen’s k-shortest-path algorithm to igraph using its Python interface so you might try this:

https://gist.github.com/ALenfant/5491853

Note that this will modify the edge IDs because it adds and removes edges temporarily. Make sure to copy your graph first before calling yen_igraph() on it.

— 
T.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]