Skip to content

Commit e408b82

Browse files
committed
chore(pmd): make discharge void and remove empty else; satisfy PMD
1 parent b273561 commit e408b82

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

src/main/java/com/thealgorithms/graph/PushRelabel.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,8 @@ public static int maxFlow(int[][] capacity, int source, int sink) {
8282
return excess[sink];
8383
}
8484

85-
private static boolean discharge(int u, State s) {
85+
private static void discharge(int u, State s) {
8686
final int n = s.residual.length;
87-
boolean pushedAny = false;
8887
while (s.excess[u] > 0) {
8988
if (s.nextNeighbor[u] >= n) {
9089
relabel(u, s.residual, s.height);
@@ -102,12 +101,10 @@ private static boolean discharge(int u, State s) {
102101
if (v != s.source && v != s.sink && prevExcessV == 0) {
103102
s.active.add(v);
104103
}
105-
pushedAny = true;
106104
} else {
107105
s.nextNeighbor[u]++;
108106
}
109107
}
110-
return pushedAny;
111108
}
112109

113110
private static final class State {
@@ -140,8 +137,6 @@ private static void relabel(int u, int[][] residual, int[] height) {
140137
}
141138
if (minHeight < Integer.MAX_VALUE) {
142139
height[u] = minHeight + 1;
143-
} else {
144-
// No outgoing residual edges; keep height unchanged
145140
}
146141
}
147142

0 commit comments

Comments
 (0)