igraph-help
[Top][All Lists]
Advanced

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

Re: [igraph] Distance()


From: Gábor Csárdi
Subject: Re: [igraph] Distance()
Date: Wed, 3 Dec 2008 13:31:24 +0100

Tamas, Marco,

I think on average this can be actually slower than doing
shortest_paths and then picking the target vertex, because you use
Python code instead of C. But one should try both if running time is
really important.

Just to answer the question as well, yes, if your graph is not
weighed, then this finds the shortest path.

G.

On Wed, Dec 3, 2008 at 1:27 PM, Marco <address@hidden> wrote:
> On Wed, Dec 3, 2008 at 12:59 PM, Tamas Nepusz <address@hidden> wrote:
>
>> def distance(g, v1, v2):
>>  for vertex, distance, _ in g.bfsiter(v1, advanced=True):
>>    if vertex.index == v2:
>>      return distance
>
> Tamas,
>
> I am sorry for my ignorance, but this assures me this is the minimum
> length path between v1 and v2?
> I'd say yes, but one never knows... :)
>
> thanks,
>
> marco
>
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/igraph-help
>



-- 
Gabor Csardi <address@hidden>     UNIL DGM




reply via email to

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