Hi given a graph G I want to compute a corresponding reachability graph; that is, for a given distance r, if the distance between two vertices is less than r they are joined by an edge. The shortest_distance function with the Johnson algorithm works fine but returns the distances between all pairs of vertices's and not just those with a distance less than r. Iterating through all distances and finding those with distance less than r is one solution but this is incredibly slow due to the size of my graph. Have you any suggestions? I’m considering using the breath first search functionality but I don’t think there is an option to terminate the search on parts the search tree with distance greater than r. thanks in advance -- View this message in context: http://main-discussion-list-for-the-graph-tool-project.982480.n3.nabble.com/... Sent from the Main discussion list for the graph-tool project mailing list archive at Nabble.com.
On 06.08.2016 14:00, padraigc wrote:
Have you any suggestions? I’m considering using the breath first search functionality but I don’t think there is an option to terminate the search on parts the search tree with distance greater than r.
Take a look at the shortest_distance() function: https://graph-tool.skewed.de/static/doc/topology.html#graph_tool.topology.sh... It accepts a "max_dist" parameter that does what you want. Best, Tiago -- Tiago de Paula Peixoto <tiago@skewed.de>
participants (2)
-
padraigc -
Tiago de Paula Peixoto