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: Ahmed Abdeen Hamed
Subject: Re: [igraph] All possible path between two nodes
Date: Mon, 25 Nov 2013 05:08:08 -0500

I tired the first idea and removed the A->B edges and it took a second to work. I love it for its simplicity and elegance!

Thanks so much,

-Ahmed


On Mon, Nov 25, 2013 at 4:58 AM, Tamás Nepusz <address@hidden> wrote:
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]