Skip to content

Commit 44df65a

Browse files
Update ZeroOneBfs.java
1 parent 8c87a65 commit 44df65a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
package com.thealgorithms.graphs;
22

3-
import java.util.*;
3+
import java.util.Deque;
4+
import java.util.ArrayDeque;
5+
import java.util.Arrays;
6+
import java.util.List;
47

58
/**
69
* 0-1 BFS for shortest paths on graphs with 0/1 edge weights.
@@ -36,7 +39,8 @@ public static int[] shortestPaths(int n, List<List<int[]>> edges, int src) {
3639
while (!dq.isEmpty()) {
3740
int u = dq.pollFirst();
3841
for (int[] e : edges.get(u)) {
39-
int v = e[0], w = e[1];
42+
int v = e[0];
43+
int w = e[1];
4044
int nd = dist[u] + w;
4145
if (nd < dist[v]) {
4246
dist[v] = nd;

0 commit comments

Comments
 (0)