Skip to content

Commit 8ddb5ed

Browse files
committed
Inline adjacency_list iteration, don't use bump alloc in stack_union
1 parent 88c36b4 commit 8ddb5ed

File tree

3 files changed

+2
-10
lines changed

3 files changed

+2
-10
lines changed

cp-algo/data_structures/stack_union.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#ifndef CP_ALGO_DATA_STRUCTURES_STACK_UNION_HPP
22
#define CP_ALGO_DATA_STRUCTURES_STACK_UNION_HPP
3-
#include "../bump_alloc.hpp"
43
#include <cstddef>
54
#include <vector>
65
namespace cp_algo::data_structures {

cp-algo/graph/base.hpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,6 @@ namespace cp_algo::graph {
2525
add_edge(u, v);
2626
}
2727
}
28-
auto adjacent_generator(int v) const {
29-
return [&adj = adj, v = adj.head[v]]() mutable {
30-
int e = v ? adj.data[v] : -1;
31-
v = adj.next[v];
32-
return e;
33-
};
34-
}
3528
auto nodes_view() const {
3629
return std::views::iota(0, n);
3730
}

cp-algo/graph/cycle.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ namespace cp_algo::graph {
99
std::vector<int> cycle;
1010
auto dfs = [&](auto &&self, int v, int pe) -> bool {
1111
state[v] = 1;
12-
auto gen = g.adjacent_generator(v);
13-
for(int e = gen(); ~e; e = gen()) {
12+
for(int sv = g.adj.head[v]; sv; sv = g.adj.next[sv]) {
13+
int e = g.adj.data[sv];
1414
if(e / 2 != pe / 2) {
1515
auto u = g.to[e];
1616
if(state[u] == 0) {

0 commit comments

Comments
 (0)