[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] Distance()
From: |
Marco |
Subject: |
Re: [igraph] Distance() |
Date: |
Wed, 3 Dec 2008 13:34:51 +0100 |
Gabor,
many thanks for the explanation.
I will try to do a benchmark on both methods, and then choose the fastest.
Thanks again!
marco
--
Quando sei una human pignata
e la pazzo jacket si è accorciata
e non ti puoi liberare
dai colpi di legno e di bastone
dai petardi sul groppone
Vinicio Capossela
On Wed, Dec 3, 2008 at 1:31 PM, Gábor Csárdi <address@hidden> wrote:
> 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
>
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/igraph-help
>