@@ -1115,7 +1115,7 @@ def feng_k_shortest_simple_paths(self, source, target, weight_function=None,
1115
1115
if self .has_loops() or self .allows_multiple_edges():
1116
1116
G = self .to_simple(to_undirected = False , keep_label = ' min' , immutable = False )
1117
1117
else :
1118
- G = self .copy()
1118
+ G = self .copy(immutable = False )
1119
1119
1120
1120
G.delete_edges(G.incoming_edges(source, labels = False ))
1121
1121
G.delete_edges(G.outgoing_edges(target, labels = False ))
@@ -1175,11 +1175,6 @@ def feng_k_shortest_simple_paths(self, source, target, weight_function=None,
1175
1175
cdef dict idx_to_path = {0 : shortest_path}
1176
1176
cdef int idx = 1
1177
1177
1178
- # candidate_paths collects (cost, path_idx, dev_idx)
1179
- # + cost is sidetrack cost from the first shortest path tree T_0
1180
- # (i.e. real length = cost + shortest_path_length in T_0)
1181
- cdef priority_queue[pair[double , pair[int , int ]]] candidate_paths
1182
-
1183
1178
# ancestor_idx_vec[v] := the first vertex of ``path[:t+1]`` or ``id_target`` reachable by
1184
1179
# edges of first shortest path tree from v.
1185
1180
cdef vector[int ] ancestor_idx_vec = [- 1 for _ in range (len (G) + len (unnecessary_vertices))]
@@ -1239,6 +1234,10 @@ def feng_k_shortest_simple_paths(self, source, target, weight_function=None,
1239
1234
return
1240
1235
1241
1236
cdef int i, deviation_i
1237
+ # candidate_paths collects (cost, path_idx, dev_idx)
1238
+ # + cost is sidetrack cost from the first shortest path tree T_0
1239
+ # (i.e. real length = cost + shortest_path_length in T_0)
1240
+ cdef priority_queue[pair[double , pair[int , int ]]] candidate_paths
1242
1241
candidate_paths.push((0 , (0 , 0 )))
1243
1242
while candidate_paths.size():
1244
1243
negative_cost, (path_idx, dev_idx) = candidate_paths.top()
@@ -1474,11 +1473,6 @@ def pnc_k_shortest_simple_paths(self, source, target, weight_function=None,
1474
1473
cdef dict idx_to_path = {0 : shortest_path}
1475
1474
cdef int idx = 1
1476
1475
1477
- # candidate_paths collects (cost, path_idx, dev_idx, is_simple)
1478
- # + cost is sidetrack cost from the first shortest path tree T_0
1479
- # (i.e. real length = cost + shortest_path_length in T_0)
1480
- cdef priority_queue[pair[pair[double , bint], pair[int , int ]]] candidate_paths
1481
-
1482
1476
# ancestor_idx_vec[v] := the first vertex of ``path[:t+1]`` or ``id_target`` reachable by
1483
1477
# edges of first shortest path tree from v.
1484
1478
cdef vector[int ] ancestor_idx_vec = [- 1 for _ in range (len (G) + len (unnecessary_vertices))]
@@ -1538,6 +1532,10 @@ def pnc_k_shortest_simple_paths(self, source, target, weight_function=None,
1538
1532
return
1539
1533
1540
1534
cdef int i, deviation_i
1535
+ # candidate_paths collects (cost, path_idx, dev_idx, is_simple)
1536
+ # + cost is sidetrack cost from the first shortest path tree T_0
1537
+ # (i.e. real length = cost + shortest_path_length in T_0)
1538
+ cdef priority_queue[pair[pair[double , bint], pair[int , int ]]] candidate_paths
1541
1539
candidate_paths.push(((0 , True ), (0 , 0 )))
1542
1540
while candidate_paths.size():
1543
1541
(negative_cost, is_simple), (path_idx, dev_idx) = candidate_paths.top()
0 commit comments