Skip to content

Commit a6e3b32

Browse files
committed
Fix
1 parent 998c6b4 commit a6e3b32

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/main/java/com/thealgorithms/datastructures/graphs/WelshPowell.java

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ public static int[] findColoring(Graph graph) {
141141
return colors;
142142
}
143143

144-
/** Helper method to check if a color is unassigned
144+
/**
145+
* Helper method to check if a color is unassigned
145146
*
146147
* @param color the color to check
147148
* @return {@code true} if the color is unassigned, {@code false} otherwise
@@ -150,7 +151,8 @@ private static boolean isBlank(int color) {
150151
return color == BLANK_COLOR;
151152
}
152153

153-
/** Checks if a vertex has adjacent colored vertices
154+
/**
155+
* Checks if a vertex has adjacent colored vertices
154156
*
155157
* @param graph the input graph
156158
* @param vertex the vertex to check
@@ -161,7 +163,8 @@ private static boolean isAdjacentToColored(Graph graph, int vertex, int[] colors
161163
return graph.getAdjacencyList(vertex).stream().anyMatch(otherVertex -> !isBlank(colors[otherVertex]));
162164
}
163165

164-
/** Initializes the colors array with blank color
166+
/**
167+
* Initializes the colors array with blank color
165168
*
166169
* @param numberOfVertices the number of vertices in the graph
167170
* @return an array of integers representing the colors assigned to the vertices
@@ -172,7 +175,8 @@ private static int[] initializeColors(int numberOfVertices) {
172175
return colors;
173176
}
174177

175-
/** Sorts the vertices by their degree in descending order
178+
/**
179+
* Sorts the vertices by their degree in descending order
176180
*
177181
* @param graph the input graph
178182
* @return an array of integers representing the vertices sorted by degree
@@ -181,7 +185,8 @@ private static Integer[] getSortedNodes(final Graph graph) {
181185
return IntStream.range(0, graph.getNumVertices()).boxed().sorted(Comparator.comparingInt(v -> - graph.getAdjacencyList(v).size())).toArray(Integer[] ::new);
182186
}
183187

184-
/** Computes the colors already used by the adjacent vertices
188+
/**
189+
* Computes the colors already used by the adjacent vertices
185190
*
186191
* @param graph the input graph
187192
* @param vertex the vertex to check
@@ -194,7 +199,8 @@ private static boolean[] computeUsedColors(final Graph graph, final int vertex,
194199
return usedColors;
195200
}
196201

197-
/** Finds the first unused color
202+
/**
203+
* Finds the first unused color
198204
*
199205
* @param usedColors the array of colors used by the adjacent vertices
200206
* @return the first unused color

0 commit comments

Comments
 (0)