mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-03-30 18:36:43 +00:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
4de67b014c
commit
92449bfb32
@ -1,6 +1,6 @@
|
|||||||
"""
|
"""
|
||||||
Graph Coloring (also called the "m coloring problem") is the problem of
|
Graph Coloring (also called the "m coloring problem") is the problem of
|
||||||
assigning at most 'm' colors to the vertices of a graph such that
|
assigning at most 'm' colors to the vertices of a graph such that
|
||||||
no two adjacent vertices share the same color.
|
no two adjacent vertices share the same color.
|
||||||
|
|
||||||
Wikipedia: https://en.wikipedia.org/wiki/Graph_coloring
|
Wikipedia: https://en.wikipedia.org/wiki/Graph_coloring
|
||||||
@ -119,7 +119,7 @@ def util_color(
|
|||||||
|
|
||||||
def color(graph: list[list[int]], max_colors: int) -> list[int]:
|
def color(graph: list[list[int]], max_colors: int) -> list[int]:
|
||||||
"""
|
"""
|
||||||
Attempts to color the graph with at most max_colors colors such that no two adjacent
|
Attempts to color the graph with at most max_colors colors such that no two adjacent
|
||||||
vertices have the same color. If it is possible, returns the list of color assignments;
|
vertices have the same color. If it is possible, returns the list of color assignments;
|
||||||
otherwise, returns an empty list.
|
otherwise, returns an empty list.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user