Hi Alexandre and thanks for your useful response
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. On the other hand, *add_edge_list()* is much
more efficient than adding
Sir,
I am trying to follow the example on "edge prediction as binary
classification".
Here is my code:
*import graph_tool as gt
import pandas as pd*
# create a graph object in data frame format
*ndf =
> Note that you can still remove the last loop altogether by accessing the
property maps as arrays: (tree.a * weight.a).sum()
This innocuous remark leads in fact to a huge speedup: you gain a factor 13,
a lot of surprise! Now, Graph Tool has the best performance among Networkit,
Igraph,
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
Am 29.11.18 um 14:59 schrieb elastica:
> Hi,
>
> Is the following code correspond to the code you have in mind:
>
>
>
> ?
>
>
It seems you forgot to actually paste the code.
--
Tiago de Paula Peixoto
signature.asc
Description: OpenPGP digital signature
Hi,
Is the following code correspond to the code you have in mind:
?
--
Sent from:
http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/
___
graph-tool mailing list
graph-tool@skewed.de
;)
Oops, that's infortunate, sorry for the confusion, yet I pasted the code
inside a raw text tag.
Again :
--
Sent from:
http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/
___
graph-tool mailing list
Again, doesn't work but the code was visible in the preview.
Here the code outside any tag:
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,
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