{"id":20373164,"url":"https://github.com/st235/hse.modernoperationsresearchmethods.graphcoloring","last_synced_at":"2026-05-11T15:03:41.548Z","repository":{"id":65238383,"uuid":"588905023","full_name":"st235/HSE.ModernOperationsResearchMethods.GraphColoring","owner":"st235","description":null,"archived":false,"fork":false,"pushed_at":"2023-02-26T22:22:46.000Z","size":4630,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-04T20:43:58.354Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/st235.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-14T12:34:30.000Z","updated_at":"2023-01-14T12:36:00.000Z","dependencies_parsed_at":"2025-01-15T05:44:20.588Z","dependency_job_id":"45048ad4-19f2-491a-862a-b0a3cf842d30","html_url":"https://github.com/st235/HSE.ModernOperationsResearchMethods.GraphColoring","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/st235/HSE.ModernOperationsResearchMethods.GraphColoring","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/st235%2FHSE.ModernOperationsResearchMethods.GraphColoring","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/st235%2FHSE.ModernOperationsResearchMethods.GraphColoring/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/st235%2FHSE.ModernOperationsResearchMethods.GraphColoring/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/st235%2FHSE.ModernOperationsResearchMethods.GraphColoring/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/st235","download_url":"https://codeload.github.com/st235/HSE.ModernOperationsResearchMethods.GraphColoring/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/st235%2FHSE.ModernOperationsResearchMethods.GraphColoring/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32900046,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-10T13:40:02.631Z","status":"online","status_checked_at":"2026-05-11T02:00:05.975Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-15T01:16:57.402Z","updated_at":"2026-05-11T15:03:41.520Z","avatar_url":"https://github.com/st235.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Graph Coloring\n\nThis is an implementation of [graph coloring](https://en.wikipedia.org/wiki/Graph_coloring) problem.\n\n| Graph | Colored |\n| ----- | ------- |\n|![Graph](resources/myciel3.png)|![Colored](resources/myciel3_colored.png)|\n\n## Build\n\n[`graph_colorization.cpp`](./graph_colorization.cpp) is the main file and contains the implementation. To build a CLI application you need to run the command below:\n\n```bash\ng++ -std=c++17 -O3 graph_colorization.cpp\n```\n\nPlease, pay attention that app requires **C++ 17**. You should use one of the [compilers that support](https://en.cppreference.com/w/cpp/compiler_support/17) the standart.\n\n## Algorithm\n\nLet me breifly describe the approach used in this project.\n\nI am using [DSatur algorithm](https://en.wikipedia.org/wiki/DSatur) by Daniel Brélaz to colorize the graph.\nDSatur is a heuristic greedy graph colouring algorithm.\n\nAs any greedy approach it is considering the verticies\nin a specific order assigning to them the smallest possible color.\n\nTo do so the algorithm is dynamically (i.e. at every step) choosing the next vertex by picking a vertex\nthe largest number of different colors among the vertices adjacent to the one under consideration.\nOnce the vertex has been coloured, the algorithm considers ramining uncolored vertices. If there is a tie\nbetween a few vertices the next step is to consider their degree in uncolored subgraph.\n\n## Output\n\nThe output of one program run can be found in **below** or in [`report.csv`](./report.csv).\n\n**Please, do pay attention, that `report.csv` also contains the solution!**\n\n```bash\n            Instance    Colors      Time, sec\n         myciel3.col         4              0\n         myciel7.col         8          0.001\n latin_square_10.col       130          0.141\n         school1.col        17          0.007\n     school1_nsh.col        28          0.005\n      mulsol.i.1.col        49          0.001\n      inithx.i.1.col        54          0.007\n            anna.col        11              0\n            huck.col        11              0\n            jean.col        10              0\n       miles1000.col        42          0.001\n       miles1500.col        73          0.002\n      fpsol2.i.1.col        65          0.004\n        le450_5a.col        10          0.002\n       le450_15b.col        17          0.003\n       le450_25a.col        25          0.003\n        games120.col         9              0\n      queen11_11.col        14          0.001\n        queen5_5.col         5              0\n```\n\nIf you're interested in visualising colors you can take a look \nat [`colors_report.txt`](./colors_report.txt). This file contains all\ncolors that have been assigned to the vertices in order of their appearance in\na file containing the graph.\n\n## Misc\n\n### Changes to the template\n\nThe most significant change made to the original template is the `Check` method. \nInstead of considering `0` as **not a color**, I am considering `kColorNoColor = -1`.\nI am using colors as an index in other arrays, therefore indexing them from `0` seems\nmore convenient.\n\n### Visualisation\n\nAdditionally, to the `Check` method I prepared a small Python script\nto visualise graphs. You can find the script at [graph_visualisation.py](./graph_visualisation.py).\n\nYou need [streamlit](https://pypi.org/project/streamlit/) and [steamlit_agraph](https://pypi.org/project/streamlit-agraph/) installed. To run visualisation script use the command below:\n\n```bash\nstreamlit run graph_visualisation.py\n```\n\nIf you see the interface like the interface below the script is running just fine. Hooray 🎉\n\n![Visualisation interface](./resources/interface.png)\n\n### Additional examples\n\n| Graph | Colored |\n| ----- | ------- |\n|![Graph](./resources/anna.png)|![Colored](./resources/anna_colored.png)|\n|![Graph](./resources/huck.png)|![Colored](./resources/hucked_colored.png)|\n|![Graph](./resources/queen5.png)|![Colored](./resources/queen5_colored.png)|\n\nThank you for reading!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fst235%2Fhse.modernoperationsresearchmethods.graphcoloring","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fst235%2Fhse.modernoperationsresearchmethods.graphcoloring","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fst235%2Fhse.modernoperationsresearchmethods.graphcoloring/lists"}