[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [igraph] Fast sum of nodes attributes
From: |
Gábor Csárdi |
Subject: |
Re: [igraph] Fast sum of nodes attributes |
Date: |
Mon, 24 Nov 2014 13:08:15 -0500 |
Query the whole vector at once with VANV, and then call
igraph_vector_sum(). Although this copies the vector once, so might
not be faster....
G.
On Mon, Nov 24, 2014 at 12:10 PM, Matheus Viana <address@hidden> wrote:
> Hi all.
>
> I would like to know if there is any fastest way to sum the attribute
> "MyAttribute" of all nodes, other than that:
>
> double sum = 0.0;
> for (node = igraph_vcount(&Graph); node--;) {
> sum += VAN(&Graph,"MyAttribute",node);
> }
>
> Many thanks,
>
> Matheus Viana
> Postdoctoral Research Employee
> Developmental and Cell Biology
> University of California Irvine
>
>
>
> _______________________________________________
> igraph-help mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/igraph-help
>