{"id":15735654,"url":"https://github.com/vahancho/graphene","last_synced_at":"2025-03-31T04:14:57.279Z","repository":{"id":210886044,"uuid":"663405016","full_name":"vahancho/graphene","owner":"vahancho","description":"An abstract graph C++ library","archived":false,"fork":false,"pushed_at":"2023-12-21T13:22:12.000Z","size":15197,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-06T08:45:14.348Z","etag":null,"topics":["algorithm","cpp","cpp11","cpp17","dejkstra","geodesy","graph","graphen","hamburg","map","navigation","road-network","roadmap","shortest-path","shortest-paths","templates"],"latest_commit_sha":null,"homepage":"","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/vahancho.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-07-07T08:08:17.000Z","updated_at":"2024-02-29T07:34:49.000Z","dependencies_parsed_at":"2023-12-05T12:25:26.880Z","dependency_job_id":"521a3732-f03c-4d8a-8f3d-dcad1a12426b","html_url":"https://github.com/vahancho/graphene","commit_stats":{"total_commits":31,"total_committers":1,"mean_commits":31.0,"dds":0.0,"last_synced_commit":"3ceddc214c97acf7ada537f72e3d1cf7d1f84eb4"},"previous_names":["vahancho/graphene"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vahancho%2Fgraphene","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vahancho%2Fgraphene/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vahancho%2Fgraphene/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vahancho%2Fgraphene/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vahancho","download_url":"https://codeload.github.com/vahancho/graphene/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246413237,"owners_count":20773053,"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":["algorithm","cpp","cpp11","cpp17","dejkstra","geodesy","graph","graphen","hamburg","map","navigation","road-network","roadmap","shortest-path","shortest-paths","templates"],"created_at":"2024-10-04T01:14:19.805Z","updated_at":"2025-03-31T04:14:57.258Z","avatar_url":"https://github.com/vahancho.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"- [The Graphene](#the-graphene)\n  - [Prerequisites](#prerequisites)\n  - [Shortest paths](#shortest-paths)\n  - [API and usage](#api-and-usage)\n  - [Build and test](#build-and-test)\n  - [Examples](#examples)\n    - [Hamburger road network](#hamburger-road-network)\n      - [The Hamburger road network](#the-hamburger-road-network)\n      - [The shortest path between two streets](#the-shortest-path-between-two-streets)\n    - [California road network](#california-road-network)\n- [See also](#see-also)\n\n# The Graphene\n\n`Graphene` is a header-only library that implements an abstract graph. The class template allows\ncreation of graphs of any types of nodes both directed and undirected with\nthe custom weight function.\n\n[![Latest release](https://img.shields.io/github/v/release/vahancho/graphene?include_prereleases)](https://github.com/vahancho/graphene/releases)\n[![Build and test (CMake)](https://github.com/vahancho/graphene/actions/workflows/cmake.yml/badge.svg)](https://github.com/vahancho/graphene/actions/workflows/cmake.yml)\n[![Code coverage](https://codecov.io/gh/vahancho/graphene/graph/badge.svg?token=YLMFIEZBGG)](https://codecov.io/gh/vahancho/graphene)\n\n## Prerequisites\n\nNo special requirements except *C++17* compliant compiler. The class is tested with\n*gcc* and *MSVC* compilers. In order to build and run unit tests\nfor this project you are required to have Google Test library installed on the system.\nFor more details see the CI badges or [GitHub Actions](https://github.com/vahancho/graphene/actions).\n\n## Shortest paths\n\nThe library calculates shortest path between two nodes using the Dijkstra algorithm.\nHowever the term \"shortest\" is an abstraction, because the distance between\nto nodes is just a particular notion of the weight of the graph edge. `Graphene`\nallows to define custom weight functions, so that the algorithm will calculate\nnot only the shortest path, but the path that corresponds to the minimal overall\n\"weight\".\n\n## API and usage\n\n```cpp\n#include \"graphene.h\"\n\n// Declare a graph with nodes as integer values\nGraphene\u003cint\u003e graph;\n\ngraph.addNode(0);\ngraph.addNode(42);\n\ngraph.addEdge(0, 42);\ngraph.addEdge(1, 2);\n\n```\n\nCalculate the shortest path between two nodes\n\n```cpp\n#include \"graphene.h\"\n\n// 1--2--5--8\n//  \\     \\/\n//   10---6---7\n//\nGraphene\u003cint\u003e graph;\n\nauto weightFunction = [](int x, int y) -\u003e int {\n    return std::abs(x - y);\n};\n\ngraph.addEdge(1, 2);\ngraph.addEdge(2, 5);\ngraph.addEdge(5, 6);\ngraph.addEdge(5, 8);\ngraph.addEdge(8, 6);\ngraph.addEdge(1, 10);\ngraph.addEdge(10, 6);\ngraph.addEdge(6, 7);\n\npath = graph.shortestPath(1, 6, weightFunction);\n// path = {1, 2, 5, 6}\n```\n\n## Build and test\n\nIn order to build the project please use the following commands:\n\n```bash\ncmake -B build -DCMAKE_BUILD_TYPE=Release -DENABLE_TESTING=True\ncmake --build build --config Release\n```\n\nTo run the unit tests\n\n```bash\nctest -C Release --verbose\n```\n\n## Examples\n\nThe `ca_roadmap` and `hh_roadmap` examples demonstrate how to use `Graphene` library\nto create road maps and find shortest paths between two nodes.\n\n### Hamburger road network\n\nThe Hamburger road network is an interactive sample application which uses the large dataset\n[Road network Hamburg (INSPIRE)](https://data.europa.eu/data/datasets/19a39b3a-2d9e-4805-a5e6-56a5ca3ec8cb?locale=en)\nprovided by Behörde für Verkehr und Mobilitätswende (BVM)\n[Data license Germany – attribution – Version 2.0](http://www.govdata.de/dl-de/by-2-0).\nThe data set is represented by a number of CSV files which we parse and extract\nthe streets network (geodetic coordinates and street names) of the city.\n\nThe `hh_roadmap` application's usage example is:\n\n```bash\n./hh_roadmap\n```\n\nThe application prompts for the start and end street names and calculates the\nshortest path between them as well as the distance. The resulting `KML` file\nsaves into the `/data/hh_roadmap_output.kml` file.\n\n#### The Hamburger road network\n\n\u003cimg src=\"./examples/data/hamburg_roadmap.png\" alt=\"Hamburg Road Network\" width=\"400\"\u003e\n\n#### The shortest path between two streets\n\n\u003cimg src=\"./examples/data/hamburg_shortestpath.png\" alt=\"The shortest path between two streets\" width=\"600\"\u003e\n\n### California road network\n\nAs an input we used the [California Road Network](https://users.cs.utah.edu/~lifeifei/SpatialDataset.htm)\nwhich represented by two files: `/examples/data/nodes_lon_lat.txt` with the nodes'\ngeodetic coordinates and `/examples/data/edges.txt` file with nodes indexes and\ndistance between them.\nUsing this data we created an undirected graph and use `Graphene::shortestPaths()`\nfunction to find all paths that connect a node with all others. The tool exports\nthe results as a [KML](https://en.wikipedia.org/wiki/Keyhole_Markup_Language) file\nwhich can be loaded, for example, into Google Earth application for visualization.\n\nThe `ca_roadmap` application's usage example is:\n\n```bash\n./ca_roadmap 10000\n```\nwhere `10000` is the max. number of paths to export.\n\n\u003cimg src=\"./examples/data/california_roadmap.png\" alt=\"California Road Network\" width=\"350\"\u003e\n\n# See also\n\n[California Road Network](https://users.cs.utah.edu/~lifeifei/SpatialDataset.htm)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvahancho%2Fgraphene","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvahancho%2Fgraphene","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvahancho%2Fgraphene/lists"}