On 09.07.2015 10:46, François Kawala wrote:
> 2015-07-08 16:32 GMT+02:00 François Kawala <francois.kawala@gmail.com <mailto:francois.kawala@gmail.com>>:
You have to pass vertex descriptors, not integers. For instance, just>
> Hello,
>
> Here is a code snippet where I try to use the shortest_path function with a precomputed predecessor_map.
>
> targets = range(1,10)
>
> source = 0
>
> distances_in, pred_map = shortest_distance(graph,
> source=source,
> target=targets,
> weights=graph.ep[EDGE_LEN],
> pred_map=True)
>
> inward_path = shortest_path(graph,
> source=source,
> target=targets[5],
> pred_map=pred_map)
>
> To run that code ends in:
>
> File "/usr/lib/python2.7/dist-packages/graph_tool/topology/__init__.py", line 1348, in shortest_path
> if pred_map[target] == int(target): # no path to target
> File "/usr/lib/python2.7/dist-packages/graph_tool/__init__.py", line 438, in __getitem__
> return self.__map[self.__key_trans(k)]
> Boost.Python.ArgumentError: Python argument types in
> VertexPropertyMap<int64_t>.__getitem__(VertexPropertyMap<int64_t>, numpy.int64)
> did not match C++ signature:
> __getitem__(graph_tool::PythonPropertyMap<boost::checked_vector_property_map<long, boost::typed_identity_property_map<unsigned long> > > {lvalue}, graph_tool::PythonVertex)
>
>
>
> How could i circumvent that issue ?
use graph.vertex(source) instead of source. Same thing for target.
Best,
Tiago
--
Tiago de Paula Peixoto <tiago@skewed.de>
_______________________________________________
graph-tool mailing list
graph-tool@skewed.de
http://lists.skewed.de/mailman/listinfo/graph-tool