{"id":17398920,"url":"https://github.com/noweh/laravel-dijkstra","last_synced_at":"2025-10-06T05:10:17.274Z","repository":{"id":55489862,"uuid":"522894053","full_name":"noweh/laravel-dijkstra","owner":"noweh","description":"Dijkstra Shortest path-algorithm for Laravel.","archived":false,"fork":false,"pushed_at":"2022-09-02T19:00:38.000Z","size":359,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-29T04:11:15.872Z","etag":null,"topics":["dijkstra-algorithm","graph-algorithms","laravel-package","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","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/noweh.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}},"created_at":"2022-08-09T10:00:19.000Z","updated_at":"2024-04-10T11:40:32.000Z","dependencies_parsed_at":"2022-08-15T01:31:14.911Z","dependency_job_id":null,"html_url":"https://github.com/noweh/laravel-dijkstra","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noweh%2Flaravel-dijkstra","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noweh%2Flaravel-dijkstra/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noweh%2Flaravel-dijkstra/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/noweh%2Flaravel-dijkstra/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/noweh","download_url":"https://codeload.github.com/noweh/laravel-dijkstra/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249183832,"owners_count":21226267,"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":["dijkstra-algorithm","graph-algorithms","laravel-package","php"],"created_at":"2024-10-16T15:03:10.476Z","updated_at":"2025-10-06T05:10:17.181Z","avatar_url":"https://github.com/noweh.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Dijkstra algorithm for Laravel\n\n[![Laravel](https://img.shields.io/badge/Laravel-v8/v9-828cb7.svg?logo=Laravel\u0026color=FF2D20)](https://laravel.com/)\n![PHP](https://img.shields.io/badge/PHP-v7.3-828cb7.svg?style=flat-square)\n[![MIT Licensed](https://img.shields.io/github/license/noweh/laravel-dijkstra)](LICENSE)\n\nA laravel implementation of [Dijkstra algorithm](https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm).\n\nDijkstra's algorithm, conceived by computer scientist Edsger Dijkstra, is a graph search algorithm that solves in single-source shortest path problem for a graph with non-negative edge path costs, producing a shortest path tree.\n\n## Installation\n\nFirst you need to add the component to your composer.json\n\n```\ncomposer require noweh/laravel-dijkstra\n```\n\nUpdate your packages with *composer update* or install with *composer install*.\n\nLaravel uses Package Auto-Discovery, so doesn't require you to manually add the ServiceProvider.\n\n### Laravel without auto-discovery\n\nAfter updating composer, add the ServiceProvider to the providers array in config/app.php\n\n    Noweh\\Dijkstra\\DijkstraServiceProvider::class,\n\n### Migration\n\nThe migrations of this package are publishable under the \"migrations\" tag via:\n\n    php artisan vendor:publish --provider=\"Noweh\\Dijkstra\\DijkstraServiceProvider\" --tag=\"migrations\"\n\n## Usage\n\n### Operations with Points and draw graph / find shortest path\n```php\n    \u003c?php\n\n    /** @var IPointsService $pointsService */\n    $pointsService = \\Dijkstra::pointsService();\n\n    // Create all points\n    $pointsService-\u003ecreateStructure([\n            ['name' =\u003e 'A', 'x' =\u003e 250, 'y' =\u003e 120],\n            ['name' =\u003e 'B', 'x' =\u003e 120, 'y' =\u003e 228],\n            // ...\n            ['name' =\u003e 'H', 'x' =\u003e 400, 'y' =\u003e 460]\n        ], [\n            ['A' =\u003e 'B'],\n            // ...\n            ['H' =\u003e 'D']\n        ]);\n\n    // add One point\n    $pointsService-\u003eaddPoint(['name' =\u003e 'I', 'x' =\u003e 60, 'y' =\u003e 30]);\n\n    // Remove one point\n    $pointsService-\u003eremovePoint('B');\n\n    // Add relation\n    $pointsService-\u003eaddRelation(['E' =\u003e 'I']);\n\n    // Remove relation\n    $pointsService-\u003eremoveRelation(['A' =\u003e 'B']);\n\n    // Retrieve all points\n    dump($pointsService-\u003egetPoints());\n\n    /** @var IGraphService $graphService */\n    $graphService = \\Dijkstra::graphService();\n    $pointFrom = $pointsService-\u003egetPoint('B');\n    $pointTo = $pointsService-\u003egetPoint('C');\n    \n    dump($graphService-\u003efindShortestPath($pointFrom, $pointTo));\n    \n    // Draw a Graph\n    $graphService-\u003edrawGraph($pointFrom, $pointTo);\n```\n#### Display example with the use of the drawGraph() method\n![](assets/example.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoweh%2Flaravel-dijkstra","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnoweh%2Flaravel-dijkstra","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnoweh%2Flaravel-dijkstra/lists"}