TheAlgorithms / C-Plus-Plus

Collection of various algorithms in mathematics, machine learning, computer science and physics implemented in C++ for educational purposes.
https://thealgorithms.github.io/C-Plus-Plus
MIT License
30.51k stars 7.23k forks source link

Feature Request: Implement Graph Colouring Algorithm #2792

Open THIRU-1074 opened 1 week ago

THIRU-1074 commented 1 week ago

Detailed description

I would like to request the implementation of a Graph Colouring Algorithm as a feature in this repository. Graph colouring is a way of assigning labels (often referred to as "colours") to the vertices of a graph such that no two adjacent vertices share the same label.

Context

This algorithm has multiple applications, including:

Possible implementation

Implementation of a Greedy Graph colouring Algorithm as a baseline. This algorithm assigns the smallest possible colour to each vertex while ensuring that no two adjacent vertices share the same colour. Additionally, an implementation of Backtracking can be provided to find more optimal solutions for graphs that require a minimal number of colours.

Additional information

(https://en.wikipedia.org/wiki/Graph_coloring)

ritk20 commented 1 week ago

Implementation of graph colouring using backtracking exists here. I guess other colouring algorithms can be added.

THIRU-1074 commented 1 week ago

Yes , DSatur is good to be implemented, this algorithm has better performance compared to existing one in repo.