summaryrefslogtreecommitdiff
path: root/graph
diff options
context:
space:
mode:
authorMZuenni <michi.zuendorf@gmail.com>2023-03-01 16:56:27 +0100
committerMZuenni <michi.zuendorf@gmail.com>2023-03-01 16:56:27 +0100
commitb15088d04aac27a3ef94cf79e68d681d735b1bbc (patch)
tree96ba00e474790acd62d10a5d1ae5699e42cf6b4c /graph
parentd8eefacaebee4e08aa92ae507d49079d90a93580 (diff)
reformatted empty lines
Diffstat (limited to 'graph')
-rw-r--r--graph/TSP.cpp4
-rw-r--r--graph/bellmannFord.cpp2
-rw-r--r--graph/connect.cpp8
3 files changed, 7 insertions, 7 deletions
diff --git a/graph/TSP.cpp b/graph/TSP.cpp
index e0fced6..cfb1b4d 100644
--- a/graph/TSP.cpp
+++ b/graph/TSP.cpp
@@ -3,7 +3,7 @@ vector<vector<ll>> dist; // Entfernung zwischen je zwei Punkten.
void TSP() {
int n = sz(dist), m = 1 << n;
vector<vector<edge>> dp(n, vector<edge>(m, edge{INF, -1}));
-
+
for (int c = 0; c < n; c++)
dp[c][m-1].dist = dist[c][0], dp[c][m-1].to = 0;
@@ -18,7 +18,7 @@ void TSP() {
dp[c][v].to = g;
}}}}}
// return dp[0][1]; // Länge der Tour
-
+
vector<int> tour; tour.push_back(0); int v = 0;
while (tour.back() != 0 || sz(tour) == 1)
tour.push_back(dp[tour.back()]
diff --git a/graph/bellmannFord.cpp b/graph/bellmannFord.cpp
index 785a42d..7ba51c0 100644
--- a/graph/bellmannFord.cpp
+++ b/graph/bellmannFord.cpp
@@ -1,7 +1,7 @@
void bellmannFord(int n, vector<edge> edges, int start) {
vector<ll> dist(n, INF), parent(n, -1);
dist[start] = 0;
-
+
for (int i = 1; i < n; i++) {
for (edge& e : edges) {
if (dist[e.from] != INF &&
diff --git a/graph/connect.cpp b/graph/connect.cpp
index b25d844..a7b2811 100644
--- a/graph/connect.cpp
+++ b/graph/connect.cpp
@@ -2,13 +2,13 @@ struct connect {
int n;
vector<pair<int, int>> edges;
LCT lct; // min LCT no updates required
-
+
connect(int n, int m) : n(n), edges(m), lct(n+m) {}
-
+
bool connected(int a, int b) {
return lct.connected(&lct.nodes[a], &lct.nodes[b]);
}
-
+
void addEdge(int a, int b, int id) {
lct.nodes[id + n] = LCT::Node(id + n, id + n);
edges[id] = {a, b};
@@ -20,7 +20,7 @@ struct connect {
lct.link(&lct.nodes[a], &lct.nodes[id + n]);
lct.link(&lct.nodes[b], &lct.nodes[id + n]);
}}
-
+
void eraseEdge(ll id) {
if (connected(edges[id].first, edges[id].second) &&
lct.query(&lct.nodes[edges[id].first],