> 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);
> }
If your compiler supports OpenMP and you have multiple CPU cores, you can try 
this:

double sum = 0.0;

#pragma omp for reduction(+:sum) nowait
for (node = igraph_vcount(&graph); node--; ) {
    sum += VAN(&graph, "MyAttribute", node);
}

-- 
T.

_______________________________________________
igraph-help mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/igraph-help

Reply via email to