diff options
| author | Gloria Mundi <gloria@gloria-mundi.eu> | 2024-11-27 15:36:04 +0100 |
|---|---|---|
| committer | Gloria Mundi <gloria@gloria-mundi.eu> | 2024-11-27 15:40:02 +0100 |
| commit | 69c98b39106cc2776f6a4983e548338ac24b5e84 (patch) | |
| tree | 4596c0c521d9afbb1a4851d713f8002314b09eaf /test | |
| parent | 5815ea20f634a935807dd4ced1eda1664aae5246 (diff) | |
simplify dijkstra
Diffstat (limited to 'test')
| -rw-r--r-- | test/graph/dijkstra.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/test/graph/dijkstra.cpp b/test/graph/dijkstra.cpp index c0cfb7e..18420ac 100644 --- a/test/graph/dijkstra.cpp +++ b/test/graph/dijkstra.cpp @@ -13,21 +13,21 @@ void stress_test() { int n = Random::integer<int>(2, 30); int m = Random::integer<int>(n-1, max<int>(n, min<int>(500, n*(n-1) / 2 + 1))); - vector<vector<path>> adj(n); + vector<vector<pair<int, ll>>> adj(n); vector<edge> edges; Graph<NoData, true> g(n); g.erdosRenyi(m); g.forEdges([&](int a, int b){ ll w = Random::integer<ll>(1, 1'000'000'000'000ll); - adj[a].push_back({w, b}); + adj[a].emplace_back(b, w); edges.push_back({a, b, w}); }); for (int i = 0; i < n; i++) { auto got = dijkstra(adj, i); auto expected = bellmannFord(n, edges, i); - + if (got != expected) cerr << "error" << FAIL; queries += n; } @@ -41,12 +41,12 @@ void performance_test() { timer t; Graph<NoData> g(N); g.erdosRenyi(M); - vector<vector<path>> adj(N); + vector<vector<pair<int, ll>>> adj(N); g.forEdges([&](int a, int b){ ll w1 = Random::integer<ll>(1, 1'000'000'000'000ll); ll w2 = Random::integer<ll>(1, 1'000'000'000'000ll); - adj[a].push_back({w1, b}); - adj[b].push_back({w2, a}); + adj[a].emplace_back(b, w1); + adj[b].emplace_back(a, w2); }); t.start(); |
