Am 29.11.18 um 10:20 schrieb elastica:
> The *add_edge_list* internally changes edges ordering to the lexicographic
> one so in order to set weights, I have to sort the weighted-edge list,
> adding some little overhead.

That's not true; no re-ordering is performed by add_edge_list().

> On the other hand, *add_edge_list()* is much
> more efficient than adding edges one by one with the add_edge method (about
> 7 times faster!). Unfortunately, this is still slow, even slower than
> NetworkX (about 1.2 times slower and we all know that NetworkX highest
> quality is not speed).

That's because you are looping over the edges _twice_. Take a more careful
look at the documentation for add_edge_list(), and you find that it accepts
an "eprops" parameters, which lists the edge property maps that need to be
filled as well. Just pass your weights to this parameter, and feed it a list
of (source, target, weight).

For it to be even faster, you can make your edge list be a Numpy array ---
in which case the entire loop will be in C++.

-- 
Tiago de Paula Peixoto <[email protected]>

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
graph-tool mailing list
[email protected]
https://lists.skewed.de/mailman/listinfo/graph-tool

Reply via email to