PHPackages                             bingo-soft/graphp - 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. bingo-soft/graphp

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

bingo-soft/graphp
=================

Free PHP library that provides mathematical graph-theory objects and algorithms

v1.3(6y ago)02.1kMITPHPPHP ^7.2

Since Nov 7Pushed 6y ago1 watchersCompare

[ Source](https://github.com/bingo-soft/graphp)[ Packagist](https://packagist.org/packages/bingo-soft/graphp)[ RSS](/packages/bingo-soft-graphp/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (4)Dependencies (4)Versions (6)Used By (0)

[![Latest Stable Version](https://camo.githubusercontent.com/a9520997c8f0be46d869abe975b482c85d547fc6aa6fcd6b9d87c78c3f00f26d/68747470733a2f2f706f7365722e707567782e6f72672f62696e676f2d736f66742f6772617068702f762f737461626c652e706e67)](https://packagist.org/packages/bingo-soft/graphp)[![Build Status](https://camo.githubusercontent.com/26100cf0980d41dbb8fe21ffdb2f981f5f67e3437639cfeddd783845fdbd8c6e/68747470733a2f2f7472617669732d63692e6f72672f62696e676f2d736f66742f6772617068702e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/bingo-soft/graphp)[![Minimum PHP Version](https://camo.githubusercontent.com/4c62148864d567c4ee794ffab09c1dd4a3f45e41064bbb016440beddaae71a4d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344253230372e322d3838393242462e737667)](https://php.net/)[![License: MIT](https://camo.githubusercontent.com/784362b26e4b3546254f1893e778ba64616e362bd6ac791991d2c9e880a3a64e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d677265656e2e737667)](https://opensource.org/licenses/MIT)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/32f288d9ed837d37d58cc569d37ec2060e9db8298d99a553e57e9540e87c1b0c/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f62696e676f2d736f66742f6772617068702f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/bingo-soft/graphp/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/3b60db8f15f7baa1f67eefa9ce5d502eca21fbc532b6edde82127244b83d741f/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f62696e676f2d736f66742f6772617068702f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/bingo-soft/graphp/?branch=master)

Graphp
======

[](#graphp)

Graphp is a PHP library, which provides mathematical graph-theory objects and algorithms.

Installation
============

[](#installation)

Install Graphp, using Composer:

```
composer require bingo-soft/graphp

```

Basic example
=============

[](#basic-example)

```
use Graphp\GraphUtils;
use Graphp\Graph\Types\SimpleWeightedGraph;
use Graphp\Edge\DefaultWeightedEdge;
use Graphp\Vertex\Vertex;
use Graphp\Alg\Shortestpath\DijkstraShortestPath;

// Create vertices
$v1 = new Vertex("v1");
$v2 = new Vertex("v2");
$v3 = new Vertex("v3");
$v4 = new Vertex("v4");
$v5 = new Vertex("v5");

// Create a new graph and add vertices
$graph = new SimpleWeightedGraph(DefaultWeightedEdge::class);
$graph->addVertex($v1);
$graph->addVertex($v2);
$graph->addVertex($v3);
$graph->addVertex($v4);
$graph->addVertex($v5);

// Add weighted edges to the graph
$e12 = GraphUtils::addEdge($graph, $v1, $v2, 2.0);
$e13 = GraphUtils::addEdge($graph, $v1, $v3, 3.0);
$e24 = GraphUtils::addEdge($graph, $v2, $v4, 5.0);
$e34 = GraphUtils::addEdge($graph, $v3, $v4, 20.0);
$e45 = GraphUtils::addEdge($graph, $v4, $v5, 5.0);
$e15 = GraphUtils::addEdge($graph, $v1, $v5, 100.0);

// Find shortest path between v1 and v2 using Dijkstra shortest path algorithm. Returns [$e12]
$path = (new DijkstraShortestPath($graph))->getPath($v1, $v2)->getEdgeList();

// Returns [$e12, $e24]
$path = (new DijkstraShortestPath($graph))->getPath($v1, $v4)->getEdgeList();

// Returns [$e12, $e24, $e45]
$path = (new DijkstraShortestPath($graph))->getPath($v1, $v5)->getEdgeList();

// Returns [$e13, $e12, $e24]
$path = (new DijkstraShortestPath($graph))->getPath($v3, $v4)->getEdgeList();
```

Features
--------

[](#features)

- Graph types

    - Simple graph
    - Simple weighted graph
    - Simple directed graph
    - Simple directed weighted graph
    - ...
- Algorithms

    - Shortest path algorithms
        - Dijkstra shortest path

Dependencies
------------

[](#dependencies)

Graphp depends on [Heap](https://github.com/bingo-soft/heap) library.

Acknowledgements
----------------

[](#acknowledgements)

Graphp draws inspiration from the [JGraphT](https://github.com/jgrapht/jgrapht) library.

License
-------

[](#license)

MIT

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 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 ~6 days

Total

4

Last Release

2365d ago

PHP version history (2 changes)v1.1PHP ^7.1

v1.3PHP ^7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/72e4d0dc8a6479742cdd0f141255b6f130df96cf2a1e3640349b9c737138697a?d=identicon)[bingo-soft](/maintainers/bingo-soft)

---

Top Contributors

[![bingo-soft](https://avatars.githubusercontent.com/u/48438172?v=4)](https://github.com/bingo-soft "bingo-soft (52 commits)")

---

Tags

mathgraphgraphp

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/bingo-soft-graphp/health.svg)

```
[![Health](https://phpackages.com/badges/bingo-soft-graphp/health.svg)](https://phpackages.com/packages/bingo-soft-graphp)
```

###  Alternatives

[brick/math

Arbitrary-precision arithmetic library

2.1k504.0M277](/packages/brick-math)[markrogoyski/math-php

Math Library for PHP. Features descriptive statistics and regressions; Continuous and discrete probability distributions; Linear algebra with matrices and vectors, Numerical analysis; special mathematical functions; Algebra

2.4k7.1M40](/packages/markrogoyski-math-php)[phpseclib/bcmath_compat

PHP 5.x-8.x polyfill for bcmath extension

16720.7M17](/packages/phpseclib-bcmath-compat)[graphp/graphviz

GraphViz graph drawing for the mathematical graph/network library GraPHP.

3232.1M49](/packages/graphp-graphviz)[graphp/graph

GraPHP is the mathematical graph/network library written in PHP.

711292.6k3](/packages/graphp-graph)[rubix/tensor

A library and extension that provides objects for scientific computing in PHP.

2751.4M5](/packages/rubix-tensor)

PHPackages © 2026

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