Am 23.10.18 um 20:43 schrieb Ozgun Altunkaya: > When I return the above function, it is reasonably fast, however the edge > indices don't match with those of graph (no weights), hence the weights are > wrong.
This is because you are using the edge descriptors of the wrong graph. What you probably want to do is: for e in graph.edges(): weight = get_weight(int(e.source())) ne = weighted_graph.add_edge(int(e.source()), int(e.target())) weights[ne] = weight > Also, I need to generate weighted_graph for at least 5-10 times, each with > different weights (however the edges and vertices are remain the same, > only weights change.) Is there a faster/better way to do this? You can access the weights as a numpy array via: weights.fa It can be faster to just update this array, than to re-generate the whole thing from scratch. Best, Tiago -- Tiago de Paula Peixoto <ti...@skewed.de>
signature.asc
Description: OpenPGP digital signature
_______________________________________________ graph-tool mailing list graph-tool@skewed.de https://lists.skewed.de/mailman/listinfo/graph-tool