PHPackages                             phpalgorithms/dijkstra - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. phpalgorithms/dijkstra

ActiveLibrary

phpalgorithms/dijkstra
======================

Implementation of Dijkstra's algorithm.

v3.0.0(10y ago)5190[1 issues](https://github.com/PHPAlgorithms/Dijkstra-s-algorithm/issues)MITPHPPHP &gt;=5.5.0

Since Oct 4Pushed 9y ago1 watchersCompare

[ Source](https://github.com/PHPAlgorithms/Dijkstra-s-algorithm)[ Packagist](https://packagist.org/packages/phpalgorithms/dijkstra)[ Docs](https://github.com/PHPAlgorithms/Dijkstra-s-algorithm)[ RSS](/packages/phpalgorithms-dijkstra/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (10)Dependencies (2)Versions (13)Used By (0)

Dijkstra's algorithm [![Latest Stable Version](https://camo.githubusercontent.com/14736ffd1ac0dc168bbfd2c4d60471426f44cea1170a6d83a80a253478d52b2b/68747470733a2f2f706f7365722e707567782e6f72672f706870616c676f726974686d732f64696a6b737472612f762f737461626c65)](https://packagist.org/packages/phpalgorithms/dijkstra) [![Build Status](https://camo.githubusercontent.com/7d8e65ce2d8ddbcc2f13a71d3ac0012c3f394e0618d03867e7de42fc0cb398a3/68747470733a2f2f7472617669732d63692e6f72672f504850416c676f726974686d732f44696a6b737472612d732d616c676f726974686d2e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/PHPAlgorithms/Dijkstra-s-algorithm) [![Scrutinizer Code Quality](https://camo.githubusercontent.com/647231b5dde14b843380fc2826d75294d5bca5205af808184d8d814939d82bd4/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f504850416c676f726974686d732f44696a6b737472612d732d616c676f726974686d2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/PHPAlgorithms/Dijkstra-s-algorithm/?branch=master) [![Code Climate](https://camo.githubusercontent.com/020af329f13de03a8207a960ae591f7cef2cb232d95fbb3d4a82a3da5b967dda/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f76656e74617175696c2f44696a6b737472612d732d616c676f726974686d2f6261646765732f6770612e737667)](https://codeclimate.com/github/ventaquil/Dijkstra-s-algorithm)
===================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#dijkstras-algorithm----)

My implementation of famous the algorithm for finding the shortest paths in a graph. Discovered by Edsger Dijkstra.

### Composer

[](#composer)

Use in your console

```
composer require phpalgorithms/dijkstra

```

### How to use

[](#how-to-use)

#### Create connections between points

[](#create-connections-between-points)

```
    $dijkstra = new \PHPAlgorithms\Dijkstra(function (\PHPAlgorithms\Dijkstra\Creator $creator) {
        $creator->addPoint('start');

        $creator->addPoint('another one')
                ->addDoubleRelation($creator->getPoint(0), 10)
                ->addRelation($creator->addPoint(), 3);
    });
```

#### Generate paths from first point

[](#generate-paths-from-first-point)

```
    [...]

    print_r($dijkstra->generate(0)); // \PHPAlgorithms\Dijkstra\Path object
```

#### Generate paths for all points

[](#generate-paths-for-all-points)

```
    [...]

    print_r($dijkstra->generateAll()); // array of \PHPAlgorithms\Dijkstra\Path objects
```

#### Path object important parameters

[](#path-object-important-parameters)

```
    [...]

    print_r($pathObj->distance); // how is the path long
    print_r($pathObj->nodes); // all points in this path
```

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~22 days

Recently: every ~45 days

Total

12

Last Release

3628d ago

Major Versions

v1.1.0 → v2.0.02015-11-27

v2.3.0-rc → v3.0.0-alpha.12016-04-07

PHP version history (2 changes)v2.0.0PHP &gt;=5.4.0

v3.0.0-alpha.1PHP &gt;=5.5.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/e58fe903baf146fe83832fed0b5ab35272f0fad80ba9d744786ae8952b8cd12c?d=identicon)[ventaquil](/maintainers/ventaquil)

---

Top Contributors

[![ventaquil](https://avatars.githubusercontent.com/u/10523774?v=4)](https://github.com/ventaquil "ventaquil (89 commits)")

---

Tags

phpmathAlgorithmgraphdijkstraalgorithms

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/phpalgorithms-dijkstra/health.svg)

```
[![Health](https://phpackages.com/badges/phpalgorithms-dijkstra/health.svg)](https://phpackages.com/packages/phpalgorithms-dijkstra)
```

###  Alternatives

[fisharebest/algorithm

Implementation of standard algorithms in PHP.

7192.7k1](/packages/fisharebest-algorithm)[f21/paradox

Paradox is an elegant Object Document Mananger (ODM) to use with the ArangoDB Document/Graph database server.

256.8k](/packages/f21-paradox)[mathematicator-core/tokenizer

Math Tokenizer

104.9k6](/packages/mathematicator-core-tokenizer)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
