summaryrefslogtreecommitdiff
path: root/graph
diff options
context:
space:
mode:
Diffstat (limited to 'graph')
-rw-r--r--graph/TSP.cpp4
-rw-r--r--graph/bellmannFord.cpp4
-rw-r--r--graph/bitonicTSPsimple.cpp2
-rw-r--r--graph/blossom.cpp4
-rw-r--r--graph/connect.cpp2
-rw-r--r--graph/cycleCounting.cpp2
-rw-r--r--graph/dinicScaling.cpp4
-rw-r--r--graph/havelHakimi.cpp2
-rw-r--r--graph/hopcroftKarp.cpp2
-rw-r--r--graph/maxWeightBipartiteMatching.cpp2
-rw-r--r--graph/minCostMaxFlow.cpp2
-rw-r--r--graph/pushRelabel3.cpp4
12 files changed, 17 insertions, 17 deletions
diff --git a/graph/TSP.cpp b/graph/TSP.cpp
index 0f72766..856107f 100644
--- a/graph/TSP.cpp
+++ b/graph/TSP.cpp
@@ -12,7 +12,7 @@ void TSP() {
for (int g = 0; g < n; g++) {
if (g != c && !((1 << g) & v)) {
if ((dp[g][(v | (1 << g))].dist + dist[c][g]) <
- dp[c][v].dist) {
+ dp[c][v].dist) {
dp[c][v].dist =
dp[g][(v | (1 << g))].dist + dist[c][g];
dp[c][v].to = g;
@@ -22,7 +22,7 @@ void TSP() {
vector<int> tour; tour.push_back(0); int v = 0;
while (tour.back() != 0 || sz(tour) == 1)
tour.push_back(dp[tour.back()]
- [(v |= (1 << tour.back()))].to);
+ [(v |= (1 << tour.back()))].to);
// Enthält Knoten 0 zweimal. An erster und letzter Position.
// return tour;
}
diff --git a/graph/bellmannFord.cpp b/graph/bellmannFord.cpp
index 21c7dbe..730cad2 100644
--- a/graph/bellmannFord.cpp
+++ b/graph/bellmannFord.cpp
@@ -5,14 +5,14 @@ void bellmannFord(int n, vector<edge> edges, int start) {
for (int i = 1; i < n; i++) {
for (edge& e : edges) {
if (dist[e.from] != INF &&
- dist[e.from] + e.cost < dist[e.to]) {
+ dist[e.from] + e.cost < dist[e.to]) {
dist[e.to] = dist[e.from] + e.cost;
parent[e.to] = e.from;
}}}
for (edge& e : edges) {
if (dist[e.from] != INF &&
- dist[e.from] + e.cost < dist[e.to]) {
+ dist[e.from] + e.cost < dist[e.to]) {
// Negativer Kreis gefunden.
}}
//return dist, parent;
diff --git a/graph/bitonicTSPsimple.cpp b/graph/bitonicTSPsimple.cpp
index ff605d9..4bd5ef3 100644
--- a/graph/bitonicTSPsimple.cpp
+++ b/graph/bitonicTSPsimple.cpp
@@ -12,7 +12,7 @@ double get(int p1, int p2) {
void bitonicTour() {
dp = vector<vector<double>>(sz(dist),
- vector<double>(sz(dist), -1));
+ vector<double>(sz(dist), -1));
get(0, 0);
// return dp[0][0]; // Länger der Tour
vector<int> lr = {0}, rl = {0};
diff --git a/graph/blossom.cpp b/graph/blossom.cpp
index cc19a2b..b3983ad 100644
--- a/graph/blossom.cpp
+++ b/graph/blossom.cpp
@@ -6,7 +6,7 @@ struct GM {
int head, tail;
GM(int n) : adjlist(n), pairs(n + 1, n), first(n + 1, n),
- que(n), label(n + 1, {-1, -1}) {}
+ que(n), label(n + 1, {-1, -1}) {}
void rematch(int v, int w) {
int t = pairs[v]; pairs[v] = w;
@@ -23,7 +23,7 @@ struct GM {
int findFirst(int u) {
return label[first[u]].first < 0 ? first[u]
- : first[u] = findFirst(first[u]);
+ : first[u] = findFirst(first[u]);
}
void relabel(int x, int y) {
diff --git a/graph/connect.cpp b/graph/connect.cpp
index 28a6f6c..b29e0e1 100644
--- a/graph/connect.cpp
+++ b/graph/connect.cpp
@@ -24,7 +24,7 @@ struct connect {
void eraseEdge(ll id) {
if (connected(edges[id].first, edges[id].second) &&
lct.query(&lct.nodes[edges[id].first],
- &lct.nodes[edges[id].second]) == id) {
+ &lct.nodes[edges[id].second]) == id) {
lct.cut(&lct.nodes[edges[id].first], &lct.nodes[id + n]);
lct.cut(&lct.nodes[edges[id].second], &lct.nodes[id + n]);
}}
diff --git a/graph/cycleCounting.cpp b/graph/cycleCounting.cpp
index 800f27e..b64b230 100644
--- a/graph/cycleCounting.cpp
+++ b/graph/cycleCounting.cpp
@@ -45,7 +45,7 @@ struct cylces {
if (cur[i]) {
cur[i] = false;
if (findSet(edges[i].first) ==
- findSet(edges[i].second)) break;
+ findSet(edges[i].second)) break;
unionSets(edges[i].first, edges[i].second);
}}
return cur.none();
diff --git a/graph/dinicScaling.cpp b/graph/dinicScaling.cpp
index 1b58d29..5dc06d6 100644
--- a/graph/dinicScaling.cpp
+++ b/graph/dinicScaling.cpp
@@ -26,7 +26,7 @@ bool bfs() {
for (int id : adjlist[cur]) {
int to = edges[id].to;
if (dist[to] < 0 &&
- edges[id ^ 1].c - edges[id ^ 1].f >= lim) {
+ edges[id ^ 1].c - edges[id ^ 1].f >= lim) {
dist[to] = dist[cur] - 1;
q.push(to);
}}}
@@ -40,7 +40,7 @@ bool dfs(int v, ll flow) {
for (; pt[v] < sz(adjlist[v]); pt[v]++) {
int id = adjlist[v][pt[v]], to = edges[id].to;
if (dist[to] == dist[v] + 1 &&
- edges[id].c - edges[id].f >= flow) {
+ edges[id].c - edges[id].f >= flow) {
if (dfs(to, flow)) {
edges[id].f += flow;
edges[id ^ 1].f -= flow;
diff --git a/graph/havelHakimi.cpp b/graph/havelHakimi.cpp
index 9fb9846..135c4b0 100644
--- a/graph/havelHakimi.cpp
+++ b/graph/havelHakimi.cpp
@@ -4,7 +4,7 @@ vector<vector<int>> havelHakimi(const vector<int>& deg) {
vector<vector<int>> adj;
while (!pq.empty()) {
auto v = pq.top(); pq.pop();
- if (sz(pq) < v.first) return {}; //ERROR
+ if (sz(pq) < v.first) return {}; //impossible
vector<pair<int, int>> todo;
for (int i = 0; i < v.first; i++) {
auto u = pq.top(); pq.pop();
diff --git a/graph/hopcroftKarp.cpp b/graph/hopcroftKarp.cpp
index 132b249..c205ccf 100644
--- a/graph/hopcroftKarp.cpp
+++ b/graph/hopcroftKarp.cpp
@@ -22,7 +22,7 @@ bool bfs(int n) {
bool dfs(int u) {
for (int v : adjlist[u]) {
if (pairs[v] < 0 ||
- (dist[pairs[v]] > dist[u] && dfs(pairs[v]))) {
+ (dist[pairs[v]] > dist[u] && dfs(pairs[v]))) {
pairs[v] = u; pairs[u] = v;
return true;
}}
diff --git a/graph/maxWeightBipartiteMatching.cpp b/graph/maxWeightBipartiteMatching.cpp
index e7e186e..5eda19b 100644
--- a/graph/maxWeightBipartiteMatching.cpp
+++ b/graph/maxWeightBipartiteMatching.cpp
@@ -55,5 +55,5 @@ double match(int l, int r) {
}}
// Wert des Matchings
return accumulate(all(lx), 0.0) +
- accumulate(all(ly), 0.0);
+ accumulate(all(ly), 0.0);
}
diff --git a/graph/minCostMaxFlow.cpp b/graph/minCostMaxFlow.cpp
index ee8aa10..46d444c 100644
--- a/graph/minCostMaxFlow.cpp
+++ b/graph/minCostMaxFlow.cpp
@@ -37,7 +37,7 @@ struct MinCostFlow {
for (int id : adjlist[cur]) {
int to = edges[id].to;
if (edges[id].f > 0 &&
- dist[to] > dist[cur] + edges[id].cost) {
+ dist[to] > dist[cur] + edges[id].cost) {
dist[to] = dist[cur] + edges[id].cost;
pref[to] = cur; con[to] = id;
if (!inqueue[to]) {
diff --git a/graph/pushRelabel3.cpp b/graph/pushRelabel3.cpp
index d4d2e67..bdbe0a5 100644
--- a/graph/pushRelabel3.cpp
+++ b/graph/pushRelabel3.cpp
@@ -17,7 +17,7 @@ void addEdge(int from, int to, ll c) {
void addFlow(int id, ll f) {
if (ec[edges[id].to] == 0 && f > 0)
- hs[H[edges[id].to]].push_back(edges[id].to);
+ hs[H[edges[id].to]].push_back(edges[id].to);
edges[id].f += f;
edges[id^1].f -= f;
ec[edges[id].to] += f;
@@ -45,7 +45,7 @@ ll maxFlow(int s, int t) {
for (int i = 0; i < sz(adjlist[u]); i++) {
int id = adjlist[u][i];
if (edges[id].c - edges[id].f > 0 &&
- H[u] > H[edges[id].to] + 1) {
+ H[u] > H[edges[id].to] + 1) {
H[u] = H[edges[id].to] + 1;
cur[u] = i;
}}