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

Add test on `traj_prop`

The test is useless in this version since we know `traj_prop[n] == -
1` at the beginning of the iteration, but we are preparing to process
phantom patterns.
parent 51d9f861
No related branches found
No related tags found
No related merge requests found
......@@ -61,28 +61,29 @@ traj_vert_ind = []
# of vertex indices.
for n in topology.topological_sort(g):
if g.vertex(n).in_degree() >= 1:
# Find the index of the closest direct predecessor of a node:
# head of the in-edge with smallest cost.
if traj_prop[n] == - 1:
if g.vertex(n).in_degree() >= 1:
# Find the index of the closest direct predecessor of a node:
# head of the in-edge with smallest cost.
all_cost = g.get_in_edges(n, eprops = [g.edge_properties.cost_function])
# numpy array with dtype float64
all_cost = g.get_in_edges(n, eprops = [g.edge_properties.cost_function])
# numpy array with dtype float64
i_min = all_cost[:, 2].argmin()
closest_pred = all_cost[i_min, 0]
if closest_succ[closest_pred] == n:
# Assign to n the trajectory of closest_pred. This means
# updating ind_traj, traj_prop and
# traj_vert_ind. closest_pred is already in a trajectory,
# traj_prop[closest_pred]] != - 1. We extend the
# trajectory of closest_pred forward.
traj_prop[n] = traj_prop[closest_pred]
traj_vert_ind[traj_prop[n]].append(n)
i_min = all_cost[:, 2].argmin()
closest_pred = all_cost[i_min, 0]
if closest_succ[closest_pred] == n:
# Assign to n the trajectory of closest_pred. This means
# updating ind_traj, traj_prop and
# traj_vert_ind. closest_pred is already in a trajectory,
# traj_prop[closest_pred]] != - 1. We extend the
# trajectory of closest_pred forward.
traj_prop[n] = traj_prop[closest_pred]
traj_vert_ind[traj_prop[n]].append(n)
else:
ind_traj = new_traj(ind_traj, traj_prop, n, traj_vert_ind)
else:
ind_traj = new_traj(ind_traj, traj_prop, n, traj_vert_ind)
else:
ind_traj = new_traj(ind_traj, traj_prop, n, traj_vert_ind)
# traj_prop[n] != - 1
......
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