Am 29.11.18 um 16:51 schrieb elastica:
>
> def kruskal_gt(wedges,n):
>     g= gt.Graph(directed=False)
>     weight = g.new_edge_property("long long")
>     g.add_edge_list(np.array(wedges), eprops=[weight])
>     tree=min_spanning_tree(g, weights=weight)
>     return sum(b*weight[e] for (e,b) in zip(g.edges(), tree))

Yes, this is what I meant. Note that you can still remove the last loop 
altogether by accessing the property maps as arrays:

    (tree.a * weight.a).sum()

Best,
Tiago
-- 
Tiago de Paula Peixoto <ti...@skewed.de>


Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
graph-tool mailing list
graph-tool@skewed.de
https://lists.skewed.de/mailman/listinfo/graph-tool

Reply via email to