From 4905811a7c635f28827984a999aedacd910f4dc3 Mon Sep 17 00:00:00 2001 From: mzuenni Date: Tue, 29 Aug 2023 00:09:28 +0200 Subject: consistency --- graph/capacityScaling.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'graph/capacityScaling.cpp') diff --git a/graph/capacityScaling.cpp b/graph/capacityScaling.cpp index b8c747f..84af162 100644 --- a/graph/capacityScaling.cpp +++ b/graph/capacityScaling.cpp @@ -4,15 +4,15 @@ struct edge { }; vector edges; -vector> adjlist; +vector> adj; int s, t, dfsCounter; vector visited; ll capacity; void addEdge(int from, int to, ll c) { - adjlist[from].push_back(sz(edges)); + adj[from].push_back(sz(edges)); edges.push_back({from, to, 0, c}); - adjlist[to].push_back(sz(edges)); + adj[to].push_back(sz(edges)); edges.push_back({to, from, 0, 0}); } @@ -20,7 +20,7 @@ bool dfs(int x) { if (x == t) return true; if (visited[x] == dfsCounter) return false; visited[x] = dfsCounter; - for (int id : adjlist[x]) { + for (int id : adj[x]) { if (edges[id].c >= capacity && dfs(edges[id].to)) { edges[id].c -= capacity; edges[id ^ 1].c += capacity; edges[id].f += capacity; edges[id ^ 1].f -= capacity; @@ -34,7 +34,7 @@ ll maxFlow(int source, int target) { s = source; t = target; ll flow = 0; - visited.assign(sz(adjlist), 0); + visited.assign(sz(adj), 0); dfsCounter = 0; while (capacity) { while (dfsCounter++, dfs(s)) flow += capacity; -- cgit v1.2.3