Am 11.09.19 um 00:39 schrieb redBlackTree:
> Hi all,
> 
> I was trying to build a weighted graph. The input is a list of connections
> with their weights, something like
> 
> *connections = [[edge1, edge2, weight1], [edge1, edge3, weight2], ...]*
> 
> where all edges are string and all weights are float64. I called
> add-edge_list:
> 
> *graph.add_edge_list(connections, eprops =
> graph.new_edge_property("float"))*
> 
> but got this error:
> 
>  File
> ".conda/envs/graph-tool/lib/python3.7/site-packages/graph_tool/__init__.py",
> line 2460, in add_edge_list
>     libcore.add_edge_list_iter(self.__graph, edge_list, eprops)
> TypeError: No registered converter was able to produce a C++ rvalue of type
> unsigned long from this Python object of type str
> 
> What is the most efficient way to build a weighted graph in my case?

Please read the documentation more carefully: help(Graph.add_edge_list)

If your edges do not point to vertex indexes (i.e. integers), you need
the option hashed=True. Furthermore the value passed to 'eprops' needs
to be a list of property maps.

Best,
Tiago


-- 
Tiago de Paula Peixoto <[email protected]>
_______________________________________________
graph-tool mailing list
[email protected]
https://lists.skewed.de/mailman/listinfo/graph-tool

Reply via email to