Skip to content
Snippets Groups Projects
Commit 99d5a5a7 authored by Lionel GUEZ's avatar Lionel GUEZ
Browse files

Do not call `topology.shortest_path`

This looked good but was much longer. For example, for
`Global_1993_2023/Graph_anti`, this commit reduces elapsed time
approximately from 24 mn to 2 mn.
parent ebe6e6e4
No related branches found
No related tags found
No related merge requests found
......@@ -108,9 +108,13 @@ for n in topology.topological_sort(g):
if date_merging - date_splitting <= 6:
# We have a phantom pattern. Get the vertex on the
# side of the shortest path:
v_short = topology.shortest_path(
g, n1, n, weights = g.ep.cost_function,
dag = True)[0][1]
if g.ep.cost_function[(n1, pred[0])] \
+ g.ep.cost_function[(pred[0], n)] \
< g.ep.cost_function[(n1, pred[1])] \
+ g.ep.cost_function[(pred[1], n)]:
v_short = pred[0]
else:
v_short = pred[1]
if traj_prop[v_short] != traj_prop[n1]:
# Correct the trajectories that were assigned
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment