[Top][All Lists]

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

Re: [igraph] [python] simple paths

From: Tamás Nepusz
Subject: Re: [igraph] [python] simple paths
Date: Mon, 29 Jul 2013 22:44:52 +0200

> Is it possible to list all simple paths of length k between source and target 
> in igraph? networkx has a function 
> http://networkx.github.io/documentation/latest/_modules/networkx/algorithms/simple_paths.html#all_simple_paths
>  which might be a useful starting point but producing them all and filtering 
> by length seems very inefficient.
There is no such function but you can code it yourself quite easily. See this 
answer on Stack Overflow for a starting point (and also note my comment below 
it that tells you how to avoid constructing the adjacency list of the graph):


All that you need to ensure is that the function does not recurse into itself 
again if the incoming value of the `path` variable already contains four nodes. 
This is quite easy to ensure.


reply via email to

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