PHPackages                             graphita/graphita - 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. graphita/graphita

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

graphita/graphita
=================

High-performance PHP Graph Theory and Pathfinding Engine

v2.0.2(1mo ago)0208MITPHPPHP &gt;=7.4

Since Feb 18Pushed 1y ago1 watchersCompare

[ Source](https://github.com/graphita/graphita)[ Packagist](https://packagist.org/packages/graphita/graphita)[ RSS](/packages/graphita-graphita/feed)WikiDiscussions main Synced 2w ago

READMEChangelog (9)Dependencies (2)Versions (14)Used By (0)

Graphita
========

[](#graphita)

[![Latest Packagist Version](https://camo.githubusercontent.com/a773bbd672f6c5a3bd48b640a9e0d884660a0596563eecd9c7c47f956e719f38/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f67726170686974612f67726170686974613f6c6f676f3d676974687562266c6f676f436f6c6f723d7768697465267374796c653d666c61742d737175617265)](https://packagist.org/packages/graphita/graphita)[![Total Downloads](https://camo.githubusercontent.com/8fc69613b5918149c8b7c19c634cbd96e54ec37b0e066e9a7919431ebf80f443/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f67726170686974612f67726170686974612e7376673f6c6f676f3d676974687562266c6f676f436f6c6f723d7768697465267374796c653d666c61742d737175617265)](https://packagist.org/packages/graphita/graphita)[![GitHub Checks Status](https://camo.githubusercontent.com/3d4ef636fe8d798a74a1c7262712240d025eba85b185ebfe84e237849d0e9798/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f67726170686974612f67726170686974612f7068702e796d6c3f6c6f676f3d6769746875622d616374696f6e73266c6f676f436f6c6f723d7768697465267374796c653d666c61742d737175617265)](https://github.com/graphita/graphita/actions)[![Quality Score](https://camo.githubusercontent.com/74cad5d440e97f24429ca7f1fd62da546c97480eb4e17485c176918aca5e0e24/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f7175616c6974792f672f67726170686974612f67726170686974612e7376673f6c6f676f3d7363727574696e697a6572267374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/graphita/graphita)

An enterprise-grade, high-performance PHP Graph Theory and Pathfinding Engine.

**Version 2.0** is a complete architectural rewrite utilizing flat-relational mapping, strict string IDs, and $O(1)$ hash map lookups. It is designed to navigate massive graph topologies and resolve complex mathematical routing with almost zero RAM footprint.

Enterprise Feature Set
----------------------

[](#enterprise-feature-set)

Graphita provides **11 strictly-typed algorithms** divided into three domains to solve any network mapping, dependency, or routing problem:

- **Shortest Path Routing:** Instantaneous point-to-point pathfinding using **Dijkstra** (weighted), **Breadth-First Search** (fewest hops), **A\*** (heuristics/GPS), and **Bellman-Ford** (negative weight detection).
- **Structural Analysis:** Resolve entire network architectures using **Topological Sorting** (dependency resolution) and **Kruskal's Minimum Spanning Tree** (network cost optimization).
- **Exhaustive Traversals:** A custom Recursive Depth-First Search (DFS) engine that mathematically validates strict Graph Theory movements, including **Walks**, **Paths**, **Trails**, **Circuits**, and **Cycles**.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require graphita/graphita
```

Quick Start Example
-------------------

[](#quick-start-example)

Building a network and calculating the optimal shortest path takes just a few lines of code:

```
use Graphita\Graphita\Graph;
use Graphita\Graphita\Algorithms\DijkstraAlgorithm;

// 1. Initialize the Graph
$graph = new Graph();

// 2. Add Vertices
$graph->createVertex('NewYork');
$graph->createVertex('Chicago');
$graph->createVertex('LosAngeles');

// 3. Connect Vertices with Edges
$graph->createDirectedEdge('NewYork', 'Chicago')->setWeight(800);
$graph->createDirectedEdge('Chicago', 'LosAngeles')->setWeight(2000);
$graph->createDirectedEdge('NewYork', 'LosAngeles')->setWeight(2900); // More expensive direct flight

// 4. Find the absolute best Route
$algo = new DijkstraAlgorithm($graph);
$algo->setSource('NewYork')
     ->setDestination('LosAngeles')
     ->calculate();

// 5. Retrieve Results
$bestPath = $algo->getShortestResult();

print_r($bestPath->getVertices());
// Output: ['NewYork', 'Chicago', 'LosAngeles']

echo "Total Cost: $" . $bestPath->getTotalWeight();
// Output: Total Cost: $2800
```

Documentation
-------------

[](#documentation)

Comprehensive documentation, tutorials, architecture explanations, and API examples are available on our official VitePress documentation site:

**📚 [Read the Graphita Documentation](https://graphita.github.io/graphita/)**

If you are upgrading from `v1.x`, please consult the [Upgrading to V2 Guide](https://graphita.github.io/graphita/guide/upgrading) to familiarize yourself with the new String ID architecture and algorithm classes.

*(Note: The old GitHub Wiki pages have been deprecated in favor of the new documentation site).*

Requirements
------------

[](#requirements)

The current package requirements are:

- PHP &gt;= 7.4

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance60

Regular maintenance activity

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity53

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

Recently: every ~162 days

Total

9

Last Release

44d ago

Major Versions

v1.4.2 → v2.0.12026-07-05

PHP version history (2 changes)v1.0.0PHP &gt;=8.0

v1.3.0PHP &gt;=7.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/13015657?v=4)[Iman Abbasi](/maintainers/imanabbasi)[@imanabbasi](https://github.com/imanabbasi)

---

Top Contributors

[![imanabbasi](https://avatars.githubusercontent.com/u/13015657?v=4)](https://github.com/imanabbasi "imanabbasi (142 commits)")

---

Tags

graphgraph-algorithmsgraphsmathematics

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

PHPackages © 2026

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