Update backtracking/coloring.py

Co-authored-by: Christian Clauss <cclauss@me.com>
This commit is contained in:
Hardik Pawar 2024-10-01 08:22:29 +05:30 committed by GitHub
parent 42c32e7c4e
commit 7fafb02c4a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -173,6 +173,6 @@ def color(graph: list[list[int]], max_colors: int) -> list[int]:
# Use the utility function to try and color the graph starting from vertex 0 # Use the utility function to try and color the graph starting from vertex 0
if util_color(graph, max_colors, colored_vertices, 0): if util_color(graph, max_colors, colored_vertices, 0):
return colored_vertices # Return the successful color assignment return colored_vertices # The successful color assignment
return [] # Return an empty list if no valid coloring is possible return [] # Return an empty list if no valid coloring is possible