mbsoft31/graph-algorithms
PHP package of graph algorithms built on graph-core: PageRank and degree centrality, Dijkstra and A* pathfinding, BFS/DFS traversal, Tarjan SCCs, topological sort with cycle detection, and minimum spanning trees for citation-network analysis. Requires PHP 8.2+.
composer require plus a product layer. The honest buy case is two or more algorithm families in the next two quarters. A single BFS over a small graph is ~40 lines and not worth a dependency, a transitive graph-core requirement, and a bus-factor.CentralityAlgorithmInterface, PathfindingAlgorithmInterface, TraversalAlgorithmInterface) and immutable results (PathResult, MstResult) make a spike cheap: "does PageRank on our data produce rankings users actually act on?" Cheap evidence, reversible call. If the answer is no, we've spent a sprint, not a quarter.nexus-scholar/graph-core's model (string node IDs, array edge attributes, GraphInterface) and the integer-indexed AlgorithmGraph proxy used during execution. That is a data-model decision with switching costs, and it belongs in the PM's risk register alongside engineering's.graph-core ^1.0, composer require, five named classes" is a far cheaper estimate to defend than "build graph algorithms." The reverse is also true: composer test, composer stan, and composer bench shipping in the README tells you the maintenance surface you'd inherit if you fork.The scored opportunity (8.24) against 1 star / 0 dependents is the signal to act on: high capability value, near-zero adoption. That gap is whitespace for a scoped pilot, not a mandate for core infrastructure.
Consider it when:
Look elsewhere — or build — when:
AlgorithmGraph conversion at your real sizes (10k–100k nodes) before committing. composer bench exists — use it on your data, not the fixtures.graph-core helps only partially with export primitives).Adoption gate I'd apply: a proof-of-concept against production-shaped data, a documented fork/vendor contingency, deliberate version pinning across the v1.2.0 Composer rename (nexus-scholar/graph-algorithms, with a replace bridge for mbsoft31/graph-algorithms; PHP namespaces stay Mbsoft\Graph\Algorithms), and a review of the transitive graph-core dependency — all before it touches a critical path.
For executives: "This is a small, MIT-licensed PHP library that gives us production-ready graph algorithms — influence ranking, shortest paths, dependency ordering, cluster detection — that we would otherwise build from scratch over months. It lets us test graph-powered features in weeks and invest further only if the data supports it. The honest caveat: it's early-stage, single-maintainer, and derived from a research product, so I'm proposing we adopt it for one pilot feature with a fallback plan, not as core infrastructure on day one. The experiment is cheap; the information value is high."
For engineering:
"Standard algorithms — PageRank, degree centrality, Dijkstra, A*, BFS/DFS, Tarjan SCC, topological sort with cycle detection, MST — behind typed interfaces and immutable results (PathResult, MstResult), with custom weight and heuristic callbacks for non-default edge semantics. It sits on graph-core, so it slots in next to existing graph storage; it's framework-agnostic, so we wire our own bindings. Watch the v1.2.0 Composer rename (nexus-scholar/graph-algorithms with a replace bridge, namespaces still Mbsoft\Graph\Algorithms) — pin versions and migrate the require line deliberately. Two asks before we commit: benchmark AlgorithmGraph at our real graph sizes, and confirm we're comfortable owning a fork if upstream goes quiet. The codebase is readable in an afternoon — that's the real mitigation."
For product managers: "Think of this as a capability unlock with scoped risk. It enables a class of features we currently can't ship without specialist effort — 'who are the most influential nodes in this network,' 'what order should these steps run in,' 'is there a hidden circular dependency.' The play is to pick one such feature, ship it against real data, and measure whether users act on the output. If they do, we've validated the graph roadmap cheaply; if not, we've spent a sprint. Either way we learn something the roadmap currently assumes."
How can I help you explore Laravel packages today?