{"id":19944980,"url":"https://github.com/geocrystal/dijkstra","last_synced_at":"2025-05-03T16:31:53.984Z","repository":{"id":42391481,"uuid":"440932264","full_name":"geocrystal/dijkstra","owner":"geocrystal","description":"Dijkstra's algorithm using a priority queue in Crystal","archived":false,"fork":false,"pushed_at":"2024-03-30T12:24:25.000Z","size":4981,"stargazers_count":14,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-05-07T00:04:53.419Z","etag":null,"topics":["crystal","dijkstra","dijkstra-algorithm","priority-queue"],"latest_commit_sha":null,"homepage":"","language":"Crystal","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/geocrystal.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}},"created_at":"2021-12-22T17:16:21.000Z","updated_at":"2024-03-29T12:27:34.000Z","dependencies_parsed_at":"2024-03-30T13:42:42.651Z","dependency_job_id":null,"html_url":"https://github.com/geocrystal/dijkstra","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geocrystal%2Fdijkstra","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geocrystal%2Fdijkstra/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geocrystal%2Fdijkstra/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/geocrystal%2Fdijkstra/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/geocrystal","download_url":"https://codeload.github.com/geocrystal/dijkstra/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224367372,"owners_count":17299501,"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":["crystal","dijkstra","dijkstra-algorithm","priority-queue"],"created_at":"2024-11-13T00:23:41.416Z","updated_at":"2024-11-13T00:23:42.044Z","avatar_url":"https://github.com/geocrystal.png","language":"Crystal","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dijkstra\n\n[![Crystal CI](https://github.com/geocrystal/dijkstra/actions/workflows/crystal.yml/badge.svg)](https://github.com/geocrystal/dijkstra/actions/workflows/crystal.yml)\n[![License](https://img.shields.io/github/license/geocrystal/dijkstra.svg)](https://github.com/geocrystal/dijkstra/blob/master/LICENSE)\n\nDijkstra's algorithm using a priority queue in Crystal.\n\n[Dijkstra's algorithm](https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm) is an algorithm for finding the shortest paths between nodes in a graph, which may represent, for example, road networks.\n\n## Installation\n\n1. Add the dependency to your `shard.yml`:\n\n   ```yaml\n   dependencies:\n     dijkstra:\n       github: geocrystal/dijkstra\n   ```\n\n2. Run `shards install`\n\n## Usage\n\n![image](https://github.com/geocrystal/dijkstra/blob/main/samples/image.png?raw=true)\n\n```crystal\nrequire \"dijkstra\"\n\ngr = Dijkstra::Graph(Char).new(directed: true)\n\ngr.add_edge('a', 'b', 7)\ngr.add_edge('a', 'c', 9)\ngr.add_edge('a', 'f', 14)\ngr.add_edge('b', 'c', 10)\ngr.add_edge('b', 'd', 15)\ngr.add_edge('c', 'd', 11)\ngr.add_edge('c', 'f', 2)\ngr.add_edge('d', 'e', 6)\ngr.add_edge('e', 'f', 9)\n\ngr.shortest_path('a', 'e')\n# =\u003e {26, ['a', 'c', 'd', 'e']}\n\n# Directed   : a -\u003e c(9) -\u003e d(20) -\u003e e(26)\n# Undirected : a -\u003e c(9) -\u003e f(11) -\u003e e(20)\n```\n\n## Contributing\n\n1. Fork it (\u003chttps://github.com/geocrystal/dijkstra/fork\u003e)\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n\n## Contributors\n\n- [Anton Maminov](https://github.com/mamantoha) - creator and maintainer\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeocrystal%2Fdijkstra","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgeocrystal%2Fdijkstra","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgeocrystal%2Fdijkstra/lists"}