mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-22 03:24:57 +08:00
style: enable StaticVariableName
in checkstyle (#5173)
* style: enable StaticVariableName in checkstyle * Refractored: enable StaticVariableName in checkstyle * style: mark more variables as `final` --------- Co-authored-by: vaibhav <vaibhav.waghmare@techprescient.com> Co-authored-by: vil02 <vil02@o2.pl>
This commit is contained in:
@ -10,13 +10,13 @@ public final class FordFulkerson {
|
||||
|
||||
static final int INF = 987654321;
|
||||
// edges
|
||||
static int V;
|
||||
static int vertexCount;
|
||||
static int[][] capacity, flow;
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println("V : 6");
|
||||
V = 6;
|
||||
capacity = new int[V][V];
|
||||
System.out.println("Vertex Count : 6");
|
||||
vertexCount = 6;
|
||||
capacity = new int[vertexCount][vertexCount];
|
||||
|
||||
capacity[0][1] = 12;
|
||||
capacity[0][3] = 13;
|
||||
@ -32,11 +32,11 @@ public final class FordFulkerson {
|
||||
}
|
||||
|
||||
private static int networkFlow(int source, int sink) {
|
||||
flow = new int[V][V];
|
||||
flow = new int[vertexCount][vertexCount];
|
||||
int totalFlow = 0;
|
||||
while (true) {
|
||||
Vector<Integer> parent = new Vector<>(V);
|
||||
for (int i = 0; i < V; i++) {
|
||||
Vector<Integer> parent = new Vector<>(vertexCount);
|
||||
for (int i = 0; i < vertexCount; i++) {
|
||||
parent.add(-1);
|
||||
}
|
||||
Queue<Integer> q = new LinkedList<>();
|
||||
@ -45,7 +45,7 @@ public final class FordFulkerson {
|
||||
while (!q.isEmpty() && parent.get(sink) == -1) {
|
||||
int here = q.peek();
|
||||
q.poll();
|
||||
for (int there = 0; there < V; ++there) {
|
||||
for (int there = 0; there < vertexCount; ++there) {
|
||||
if (capacity[here][there] - flow[here][there] > 0 && parent.get(there) == -1) {
|
||||
q.add(there);
|
||||
parent.set(there, here);
|
||||
|
Reference in New Issue
Block a user