55#include < queue>
66namespace cp_algo ::graph {
77 struct shortest_path_context {
8- std::vector <int64_t > dist;
9- std::vector <edge_index> pre ;
8+ big_vector <int64_t > dist;
9+ big_vector <edge_index> pre ;
1010 static constexpr int64_t inf = 1e18 ;
1111 shortest_path_context (int n)
1212 : dist(n, inf), pre (n) {}
@@ -42,7 +42,7 @@ namespace cp_algo::graph {
4242
4343 struct spfa_context : shortest_path_context {
4444 std::queue<node_index> que;
45- std::vector <char > flags;
45+ big_vector <char > flags;
4646 static constexpr char in_queue = 1 ;
4747 static constexpr char invalidated = 2 ;
4848
@@ -73,7 +73,7 @@ namespace cp_algo::graph {
7373 edge_index e;
7474 node_index v;
7575 };
76- std::vector <std::basic_string<traverse_edge>> dependents;
76+ big_vector <std::basic_string<traverse_edge>> dependents;
7777
7878 deep_spfa_context (int n) : spfa_context(n), dependents(n) {}
7979
@@ -85,7 +85,7 @@ namespace cp_algo::graph {
8585 }
8686
8787 void invalidate_subtree (node_index v) {
88- std::vector <node_index> to_invalidate = {v};
88+ big_vector <node_index> to_invalidate = {v};
8989 while (!empty (to_invalidate)) {
9090 node_index u = to_invalidate.back ();
9191 to_invalidate.pop_back ();
@@ -144,8 +144,8 @@ namespace cp_algo::graph {
144144 return negative_edges ? deep_spfa (g, s) : dijkstra (g, s);
145145 }
146146
147- std::vector <edge_index> recover_path (auto const & g, auto const & pre , node_index s, node_index t) {
148- std::vector <edge_index> path;
147+ big_vector <edge_index> recover_path (auto const & g, auto const & pre , node_index s, node_index t) {
148+ big_vector <edge_index> path;
149149 node_index v = t;
150150 while (v != s) {
151151 path.push_back (pre [v]);
@@ -156,7 +156,7 @@ namespace cp_algo::graph {
156156 }
157157
158158 template <weighted_graph_type graph>
159- std::optional<std::pair<int64_t , std::vector <edge_index>>> shortest_path (graph const & g, node_index s, node_index t) {
159+ std::optional<std::pair<int64_t , big_vector <edge_index>>> shortest_path (graph const & g, node_index s, node_index t) {
160160 auto [dist, pre ] = single_source_shortest_path (g, s);
161161 if (dist[t] == shortest_path_context::inf) {
162162 return std::nullopt ;
0 commit comments