{"id":13730600,"url":"https://github.com/graphitemaster/dep_sort","last_synced_at":"2026-01-18T21:03:06.324Z","repository":{"id":49774274,"uuid":"153597168","full_name":"graphitemaster/dep_sort","owner":"graphitemaster","description":"Generic topological sorting for sorting a list of dependencies in C++17","archived":false,"fork":false,"pushed_at":"2018-10-18T09:30:55.000Z","size":4,"stargazers_count":13,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-08-04T02:09:39.587Z","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/graphitemaster.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-10-18T09:19:40.000Z","updated_at":"2023-04-26T23:42:36.000Z","dependencies_parsed_at":"2022-08-31T13:11:36.248Z","dependency_job_id":null,"html_url":"https://github.com/graphitemaster/dep_sort","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphitemaster%2Fdep_sort","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphitemaster%2Fdep_sort/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphitemaster%2Fdep_sort/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/graphitemaster%2Fdep_sort/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/graphitemaster","download_url":"https://codeload.github.com/graphitemaster/dep_sort/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224695598,"owners_count":17354433,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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-08-03T02:01:17.038Z","updated_at":"2026-01-18T21:03:06.318Z","avatar_url":"https://github.com/graphitemaster.png","language":"C++","readme":"# Dependency sorting\n\nGeneric topological sorting for sorting a list of dependencies in C++17\n\n# Use\nThere are two interfaces to choose from: `dep_sort_stl` and `dep_sort`.\n\nThe first will use `std::vector`, `std::unordered_set` and `std::unordered_map`\nto implement a highly efficent `O(V+E)` dependency resolver container.\n\nThere's also however a `dep_sort` class which lets you supplement your\nown `vector`, `set` and `map` implementions. You can use drop in\nreplacements like Google's `densehash` or `sparsehash` and stuff like\nBoost's `multimap` if working with highly dense or sparse data.\n\nAs a result this code has no real dependencies other than a working C++17\ncompiler.\n\n# Example\n```cpp\nint main() {\n  dep_sort_stl\u003cstd::string\u003e dep;\n  dep.add_node(\"a\");\n  dep.add_node(\"b\");\n  dep.add_node(\"c\");\n  dep.add_node(\"d\");\n  std::vector\u003cstd::string\u003e as = { \"b\", \"c\" };\n  std::vector\u003cstd::string\u003e bs = { \"c\" };\n  std::vector\u003cstd::string\u003e cs = { \"d\" };\n  dep.add_dependencies(\"a\", as);\n  dep.add_dependencies(\"b\", bs);\n  dep.add_dependencies(\"c\", cs);\n  const auto\u0026 result = dep.sort();\n  if (!result.has_cycles()) {\n    // print the sorted list\n    for (const auto\u0026 value : result.sorted) {\n      std::cout \u003c\u003c value \u003c\u003c std::endl;\n    }\n  } else {\n    // print nodes that could not be sorted due to cycles\n    for (const auto\u0026 value : result.unsorted) {\n      std::cout \u003c\u003c value \u003c\u003c std::endl;\n    }\n  }\n}\n```\n\n# Documentation\n\nThe interfaces are documented in `dep_sort.h`\n","funding_links":[],"categories":["C++"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphitemaster%2Fdep_sort","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgraphitemaster%2Fdep_sort","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgraphitemaster%2Fdep_sort/lists"}