Am 11.09.19 um 20:15 schrieb redBlackTree:
> After building the graph, I would like to execute shortest_distance() from a
> source node to a target node:
> 
> *dist = shortest_distance(graph, source = 'start', target = 'end', weights =
> weight)*
> 
> Seems like I need to use vertex indices of the 'start' and 'end' nodes for
> input source and target, respectively.

Yes. This is covered extensively in the documentation, in particular in
the quickstart guide:

   https://graph-tool.skewed.de/static/doc/quickstart.html

Please read the documentation. It will save both our times.

> How can I find vertex indices using vertex values (strings)? Is this finding
> in O(1) time complexity?

You can use the find_vertex() function. Its complexity is O(N). For O(1)
lookup you need to build your own dictionary mapping.

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