Hello,
The shortest_path and shortest_distance functions are fixed to be able to
handle more than one target. In order to be be more explicit, I propose for
those two functions to return a dictionary when there is more than one
target. This dictionary would be keyed by target vertex. What do you think
about that ? This behavior is implemented in
https://github.com/Fkawala/graph-tool.
I did a minimal working example which is there:
https://gist.github.com/Fkawala/afd0a666619c1d2716a5
I guess that next steps are (1) code review, and (2) performance and/or
unit tests? Is that correct ?
Best,
François.
2015-04-22 10:37 GMT+02:00 Tiago Peixoto [via Main discussion list for the
graph-tool project] <[email protected]>:
> On 22.04.2015 10:54, François wrote:
>
> > Hello,
> >
> > I realize that my C++ skill aren't sufficient to produce quality /
> > maintainable / efficient code for this feature. Would you take care of
> > this ?
> >
> > I've update my github repo <https://github.com/Fkawala/gcloud-python>,
> > it compiles but does not work.
> >
> > The current error stack is:
> >
> > Traceback (most recent call last):
> > File "<stdin>", line 1, in <module>
> > File
> "/usr/lib/python2.7/dist-packages/graph_tool/topology/__init__.py", line
> 1337, in shortest_path
> > pred_map=True)[1]
> > File
> "/usr/lib/python2.7/dist-packages/graph_tool/topology/__init__.py", line
> 1263, in shortest_distance
> > dist_map = dist_map[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<int32_t>.__getitem__(VertexPropertyMap<int32_t>, tuple)
> > did not match C++ signature:
> >
> __getitem__(graph_tool::PythonPropertyMap<boost::checked_vector_property_map<int,
> boost::typed_identity_property_map<unsigned long> > > {lvalue},
> graph_tool::PythonVertex)
> This is not really a C++ thing, you are trying to access a vertex
> property map with a tuple, instead of a vertex object. This tuple is
> probably your list of targets. You need only to update line 1259 in
> topology/__init__.py and exclude the case when 'target' is an
> iterable. For instance:
>
> if source is not None and target != -1:
> try:
> dist_map = [dist_map[t] for t in target]
> except TypeError:
> dist_map = dist_map[target]
>
> It seems you are almost there!
>
> Best,
> Tiago
>
>
> --
> Tiago de Paula Peixoto <[hidden email]
> <http:///user/SendEmail.jtp?type=node&node=4026100&i=0>>
>
>
> _______________________________________________
> graph-tool mailing list
> [hidden email] <http:///user/SendEmail.jtp?type=node&node=4026100&i=1>
> http://lists.skewed.de/mailman/listinfo/graph-tool
>
> *signature.asc* (836 bytes) Download Attachment
> <http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/attachment/4026100/0/signature.asc>
> --
> Tiago de Paula Peixoto <[email protected]>
>
>
> ------------------------------
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/Mutliple-destination-Shortest-Path-Dijkstra-tp4026059p4026100.html
> To start a new topic under Main discussion list for the graph-tool
> project, email [email protected]
> To unsubscribe from Main discussion list for the graph-tool project, click
> here
> <http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=2141189&code=ZnJhbmNvaXMua2F3YWxhQGdtYWlsLmNvbXwyMTQxMTg5fDIxMTQ0MDk4Nzk=>
> .
> NAML
> <http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>
--
François Kawala
--
View this message in context:
http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/Mutliple-destination-Shortest-Path-Dijkstra-tp4026059p4026125.html
Sent from the Main discussion list for the graph-tool project mailing list
archive at Nabble.com._______________________________________________
graph-tool mailing list
[email protected]
http://lists.skewed.de/mailman/listinfo/graph-tool