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

Give a default value to `traj_prop`

Preparing to process phantom patterns.
parent 5b74f8b7
No related branches found
No related tags found
No related merge requests found
...@@ -49,9 +49,10 @@ else: ...@@ -49,9 +49,10 @@ else:
# This happens if there are only isolated segments. # This happens if there are only isolated segments.
print("No cost values in the input file.") print("No cost values in the input file.")
traj_prop = g.new_vertex_property('int') traj_prop = g.new_vertex_property('int', val = - 1)
# Trajectory index to which a segment belongs. The trajectory index is # Trajectory index to which a segment belongs. - 1 means the segment
# also the index in lists traj_vert_ind, traj_segm and expanded_traj. # does not belong yet to any trajectory. The trajectory index is also
# the index in lists traj_vert_ind, traj_segm and expanded_traj.
ind_traj = - 1 # initialize index of trajectory ind_traj = - 1 # initialize index of trajectory
...@@ -74,7 +75,7 @@ for n in topology.topological_sort(g): ...@@ -74,7 +75,7 @@ for n in topology.topological_sort(g):
# Assign to n the trajectory of closest_pred. This means # Assign to n the trajectory of closest_pred. This means
# updating ind_traj, traj_prop and # updating ind_traj, traj_prop and
# traj_vert_ind. closest_pred is already in a trajectory, # traj_vert_ind. closest_pred is already in a trajectory,
# traj_prop[closest_pred]] is defined. We extend the # traj_prop[closest_pred]] != - 1. We extend the
# trajectory of closest_pred forward. # trajectory of closest_pred forward.
traj_prop[n] = traj_prop[closest_pred] traj_prop[n] = traj_prop[closest_pred]
traj_vert_ind[traj_prop[n]].append(n) traj_vert_ind[traj_prop[n]].append(n)
...@@ -83,7 +84,7 @@ for n in topology.topological_sort(g): ...@@ -83,7 +84,7 @@ for n in topology.topological_sort(g):
else: else:
ind_traj = new_traj(ind_traj, traj_prop, n, traj_vert_ind) ind_traj = new_traj(ind_traj, traj_prop, n, traj_vert_ind)
# traj_prop[n] is defined # traj_prop[n] != - 1
print("Number of trajectories: ", len(traj_vert_ind)) print("Number of trajectories: ", len(traj_vert_ind))
......
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