Remove type hints for function docstrings

This commit is contained in:
Hardik Pawar 2024-10-01 15:26:34 +05:30
parent 26321da52f
commit 156f8fe5fd

View File

@ -22,16 +22,16 @@ def valid_coloring(
Parameters: Parameters:
neighbours: The list representing which vertices neighbours: The list representing which vertices
are adjacent to the current vertex. are adjacent to the current vertex.
1 indicates an edge between the current vertex 1 indicates an edge between the current vertex
and the neighbour. and the neighbour.
colored_vertices (list[int]): List of current color assignments for all vertices colored_vertices: List of current color assignments for all vertices
(-1 means uncolored). (-1 means uncolored).
color (int): The color we are trying to assign to the current vertex. color: The color we are trying to assign to the current vertex.
Returns: Returns:
bool: True if the vertex can be safely colored with the given color, True if the vertex can be safely colored with the given color,
otherwise False. otherwise False.
Examples: Examples:
>>> neighbours = [0, 1, 0, 1, 0] >>> neighbours = [0, 1, 0, 1, 0]
@ -76,17 +76,17 @@ def util_color(
2.5. Uncolor given vertex 2.5. Uncolor given vertex
Parameters: Parameters:
graph (list of list of int): Adjacency matrix representing the graph. graph: Adjacency matrix representing the graph.
graph[i][j] is 1 if there is an edge graph[i][j] is 1 if there is an edge
between vertex i and j. between vertex i and j.
max_colors (int): Maximum number of colors allowed (m in the m-coloring problem). max_colors: Maximum number of colors allowed (m in the m-coloring problem).
colored_vertices (list of int): Current color assignments for each vertex. colored_vertices: Current color assignments for each vertex.
-1 indicates that the vertex has not been colored -1 indicates that the vertex has not been colored
yet. yet.
index (int): The current vertex index being processed. index: The current vertex index being processed.
Returns: Returns:
bool: True if the graph can be colored using at most max_colors, otherwise False. True if the graph can be colored using at most max_colors, otherwise False.
Examples: Examples:
>>> graph = [[0, 1, 0, 0, 0], >>> graph = [[0, 1, 0, 0, 0],
@ -131,14 +131,14 @@ def color(graph: list[list[int]], max_colors: int) -> list[int]:
otherwise, returns an empty list. otherwise, returns an empty list.
Parameters: Parameters:
graph (list of list of int): Adjacency matrix representing the graph. graph: Adjacency matrix representing the graph.
max_colors (int): Maximum number of colors allowed. max_colors: Maximum number of colors allowed.
Returns: Returns:
list of int: List of color assignments if the graph can be colored using max_colors. List of color assignments if the graph can be colored using max_colors.
Each index in the list represents the color assigned Each index in the list represents the color assigned
to the corresponding vertex. to the corresponding vertex.
If coloring is not possible, returns an empty list. If coloring is not possible, returns an empty list.
Examples: Examples:
>>> graph = [[0, 1, 0, 0, 0], >>> graph = [[0, 1, 0, 0, 0],