@@ -141,7 +141,8 @@ public static int[] findColoring(Graph graph) {
141
141
return colors ;
142
142
}
143
143
144
- /** Helper method to check if a color is unassigned
144
+ /**
145
+ * Helper method to check if a color is unassigned
145
146
*
146
147
* @param color the color to check
147
148
* @return {@code true} if the color is unassigned, {@code false} otherwise
@@ -150,7 +151,8 @@ private static boolean isBlank(int color) {
150
151
return color == BLANK_COLOR ;
151
152
}
152
153
153
- /** Checks if a vertex has adjacent colored vertices
154
+ /**
155
+ * Checks if a vertex has adjacent colored vertices
154
156
*
155
157
* @param graph the input graph
156
158
* @param vertex the vertex to check
@@ -161,7 +163,8 @@ private static boolean isAdjacentToColored(Graph graph, int vertex, int[] colors
161
163
return graph .getAdjacencyList (vertex ).stream ().anyMatch (otherVertex -> !isBlank (colors [otherVertex ]));
162
164
}
163
165
164
- /** Initializes the colors array with blank color
166
+ /**
167
+ * Initializes the colors array with blank color
165
168
*
166
169
* @param numberOfVertices the number of vertices in the graph
167
170
* @return an array of integers representing the colors assigned to the vertices
@@ -172,7 +175,8 @@ private static int[] initializeColors(int numberOfVertices) {
172
175
return colors ;
173
176
}
174
177
175
- /** Sorts the vertices by their degree in descending order
178
+ /**
179
+ * Sorts the vertices by their degree in descending order
176
180
*
177
181
* @param graph the input graph
178
182
* @return an array of integers representing the vertices sorted by degree
@@ -181,7 +185,8 @@ private static Integer[] getSortedNodes(final Graph graph) {
181
185
return IntStream .range (0 , graph .getNumVertices ()).boxed ().sorted (Comparator .comparingInt (v -> - graph .getAdjacencyList (v ).size ())).toArray (Integer [] ::new );
182
186
}
183
187
184
- /** Computes the colors already used by the adjacent vertices
188
+ /**
189
+ * Computes the colors already used by the adjacent vertices
185
190
*
186
191
* @param graph the input graph
187
192
* @param vertex the vertex to check
@@ -194,7 +199,8 @@ private static boolean[] computeUsedColors(final Graph graph, final int vertex,
194
199
return usedColors ;
195
200
}
196
201
197
- /** Finds the first unused color
202
+ /**
203
+ * Finds the first unused color
198
204
*
199
205
* @param usedColors the array of colors used by the adjacent vertices
200
206
* @return the first unused color
0 commit comments