mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-07 19:46:30 +08:00
Pyupgrade to Python 3.9 (#4718)
* Pyupgrade to Python 3.9 * updating DIRECTORY.md Co-authored-by: github-actions <${GITHUB_ACTOR}@users.noreply.github.com>
This commit is contained in:
@ -5,11 +5,10 @@
|
||||
|
||||
Wikipedia: https://en.wikipedia.org/wiki/Graph_coloring
|
||||
"""
|
||||
from typing import List
|
||||
|
||||
|
||||
def valid_coloring(
|
||||
neighbours: List[int], colored_vertices: List[int], color: int
|
||||
neighbours: list[int], colored_vertices: list[int], color: int
|
||||
) -> bool:
|
||||
"""
|
||||
For each neighbour check if coloring constraint is satisfied
|
||||
@ -35,7 +34,7 @@ def valid_coloring(
|
||||
|
||||
|
||||
def util_color(
|
||||
graph: List[List[int]], max_colors: int, colored_vertices: List[int], index: int
|
||||
graph: list[list[int]], max_colors: int, colored_vertices: list[int], index: int
|
||||
) -> bool:
|
||||
"""
|
||||
Pseudo-Code
|
||||
@ -86,7 +85,7 @@ def util_color(
|
||||
return False
|
||||
|
||||
|
||||
def color(graph: List[List[int]], max_colors: int) -> List[int]:
|
||||
def color(graph: list[list[int]], max_colors: int) -> list[int]:
|
||||
"""
|
||||
Wrapper function to call subroutine called util_color
|
||||
which will either return True or False.
|
||||
|
Reference in New Issue
Block a user