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.03k stars 7.1k forks source link

FEATURE/Addition_of_Graph_Coloring_Problem_in_Graphs_directory #2626

Closed harshika0926 closed 9 months ago

harshika0926 commented 10 months ago

Description of Change

Issue [FEATURE] Addition of Graph Coloring Problem in Graphs directory #2617 Proposal Addition of Graph Coloring Problem algorithm under in Graphs directory

Overview The graph coloring problem asks to assign colors to the vertices of a graph in such a way that no two adjacent vertices share the same color. The objective is often to color the graph with as few colors as possible.

Issue details The greedy coloring algorithm is a straightforward approach to solve this problem. Here's a basic outline of the greedy algorithm:

Ordering the Vertices: Although not strictly necessary, the algorithm can start by ordering the vertices in some fashion. Different orderings may produce different results. A common ordering is by the degree of the vertices, but the simplest is just the order in which the vertices are given. Coloring: Start with the first vertex and assign it the first color. Then move to the next vertex. For each subsequent vertex, look at its neighbors and determine what colors have already been assigned. Assign the smallest possible color that hasn't been used by its neighbors.

More Details https://en.wikipedia.org/wiki/Graph_coloring

Context This change is crucial as it addresses a common problem in graph theory solved using greedy approach, enhancing the repository's comprehensiveness

Checklist

Notes:

github-actions[bot] commented 9 months ago

This pull request has been automatically marked as abandoned because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] commented 9 months ago

Please ping one of the maintainers once you commit the changes requested or make improvements on the code. If this is not the case and you need some help, feel free to ask for help in our Gitter channel or our Discord server. Thank you for your contributions!