-----------------------------------------------------------------------------
| 360 | |
| 361 | //----------------------------------------------------------------------------- |
| 362 | std::vector<std::int32_t> |
| 363 | graph::reorder_gps(const graph::AdjacencyList<std::int32_t>& graph) |
| 364 | { |
| 365 | const std::int32_t n = graph.num_nodes(); |
| 366 | std::vector<std::int32_t> r(n, -1); |
| 367 | std::vector<std::int32_t> rv; |
| 368 | |
| 369 | // Repeat for each disconnected part of the graph |
| 370 | int count = 0; |
| 371 | while (count < n) |
| 372 | { |
| 373 | rv = gps_reorder_unlabelled(graph, r); |
| 374 | assert(!rv.empty()); |
| 375 | |
| 376 | // Reverse permutation |
| 377 | for (std::int32_t q : rv) |
| 378 | r[q] = count++; |
| 379 | } |
| 380 | |
| 381 | // Check all labelled |
| 382 | assert(std::find(r.begin(), r.end(), -1) == r.end()); |
| 383 | return r; |
| 384 | } |
| 385 | //----------------------------------------------------------------------------- |
nothing calls this directly
no test coverage detected