PHPackages                             templesofcode/nodes-and-edges - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. templesofcode/nodes-and-edges

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

templesofcode/nodes-and-edges
=============================

PHP algorithm implementations

04PHP

Since May 6Pushed 6y ago1 watchersCompare

[ Source](https://github.com/templesofcode/nodes-and-edges)[ Packagist](https://packagist.org/packages/templesofcode/nodes-and-edges)[ RSS](/packages/templesofcode-nodes-and-edges/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

nodes-and-edges
===============

[](#nodes-and-edges)

A php partial-port of the library described in

[![Build Status](https://camo.githubusercontent.com/15b332d6e1d168240f9ef1bc61215b75cbd3b803837925e4d3d25e6ef9e07a63/68747470733a2f2f7472617669732d63692e6f72672f74656d706c65736f66636f64652f636f646573616e6974792e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/templesofcode/nodes-and-edges)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/a9d0fb8add0a9cccfab320114e2fc005cc1915a7a4db5b2a0ecc524f4658656b/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f74656d706c65736f66636f64652f6e6f6465732d616e642d65646765732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/templesofcode/nodes-and-edges/?branch=master)

[![Code Coverage](https://camo.githubusercontent.com/88eb4b91bca31ed5ca6fc1f7d70617a8b738d89cf8d426f4b13a0f76b062fde5/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f74656d706c65736f66636f64652f6e6f6465732d616e642d65646765732f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/templesofcode/nodes-and-edges/?branch=master)

[![Code Intelligence Status](https://camo.githubusercontent.com/07b21ed546382dc4f93b06de98a70dc8125095c02dce3a0c9217c2bedc0fcde8/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f74656d706c65736f66636f64652f6e6f6465732d616e642d65646765732f6261646765732f636f64652d696e74656c6c6967656e63652e7376673f623d6d6173746572)](https://scrutinizer-ci.com/code-intelligence)

Example usage:

```
use TemplesOfCode\NodesAndEdges\BFS\BreadthFirstPaths;
use TemplesOfCode\NodesAndEdges\UndirectedGraph;

function bfsPaths(string $file, int $sourceVertex)
{
    // build the graph
    $graph = UndirectedGraph::fromFile($file);
    // create an instance
    $bfs = new BreadthFirstPaths($graph, $sourceVertex);
    // iterate over the set of graph vertices
    for ($vertex = 0; $vertex < $graph->getVertices(); $vertex++) {
        // is this connected to the source vertex
        if ($bfs->hasPathTo($vertex)) {
            // print to screen
            print sprintf(
                '%d to %d (%d):  ',
                $sourceVertex,
                $vertex,
                $bfs->distTo($vertex)
            );
            // iterate over the path
            foreach ($bfs->pathTo($vertex) as $x) {
                // check for self
                if ($x == $sourceVertex) {
                    print $x;
                } else {
                    print "-" . $x;
                }
            }
            print PHP_EOL;

        } else {
            print sprintf(
                '%d to %d (-):  not connected',
                $sourceVertex,
                $vertex
            );
        }
    }
}
```

See  for some additional example usage

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity33

Early-stage or recently created project

 Bus Factor1

Top contributor holds 61.4% 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.

### Community

Maintainers

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

---

Top Contributors

[![omizzy](https://avatars.githubusercontent.com/u/1174759?v=4)](https://github.com/omizzy "omizzy (27 commits)")[![templesofcode](https://avatars.githubusercontent.com/u/17423955?v=4)](https://github.com/templesofcode "templesofcode (17 commits)")

### Embed Badge

![Health badge](/badges/templesofcode-nodes-and-edges/health.svg)

```
[![Health](https://phpackages.com/badges/templesofcode-nodes-and-edges/health.svg)](https://phpackages.com/packages/templesofcode-nodes-and-edges)
```

PHPackages © 2026

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