Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Graph Algorithms

Graph Algorithms Laravel Package

mbsoft31/graph-algorithms

PHP 8.2+ graph algorithms built on nexus-scholar/graph-core. Includes PageRank and degree centrality, Dijkstra and A* shortest paths, BFS/DFS traversal, Tarjan SCC, topological sort with cycle detection, and minimum spanning tree utilities via typed APIs.

View on GitHub
Deep Wiki
Context7

PHP graph algorithms package for citation-network and research workflow experiments

Frequently asked questions about Graph Algorithms
Can I use this package for citation network analysis in a Laravel app?
Yes, this package is specifically designed for citation-network workflows like bibliographic coupling and co-citation analysis. It integrates seamlessly with Laravel’s service container and supports typed APIs for clean implementation in research tools or scholarly applications.
What Laravel versions does this package support?
The package requires PHP 8.2+ and is fully compatible with Laravel 10 and 11. It leverages modern PHP features like typed value objects, which align well with Laravel’s dependency injection system.
How do I install and set up graph-algorithms in a Laravel project?
Install via Composer with `composer require nexus-scholar/graph-algorithms`. You’ll also need `nexus-scholar/graph-core` as a dependency. Register algorithms as Laravel services using the service container (e.g., `app()->bind(Dijkstra::class, fn() => new Dijkstra(...))`).
Does this package work with custom graph data formats?
The package assumes compliance with `nexus-scholar/graph-core`'s `GraphInterface`. If your graph uses a non-compliant format (e.g., custom adjacency lists), you’ll need to create an adapter layer to map your data to the expected structure before passing it to algorithms.
How do I handle large graphs (10,000+ nodes) in production?
Use the `AlgorithmGraph` proxy for performance-critical paths, as it optimizes node lookups with integer indexing. Monitor memory usage, especially during traversals like BFS/DFS, and implement garbage collection hooks for long-running processes. Cache proxies for repeated computations.
Can I extend or override algorithms like Dijkstra or A*?
Yes, the package uses modular interfaces (e.g., `PathfindingAlgorithmInterface`) that you can extend. For example, you could implement a custom heuristic for A* or a bidirectional version of Dijkstra by creating a new class that adheres to the interface contract.
How does this package integrate with Laravel’s testing ecosystem?
The package includes Pest test coverage and can be seamlessly integrated into Laravel’s testing suite. Use dependency injection to mock algorithms in unit tests (e.g., `app()->bind(Dijkstra::class, fn() => MockDijkstra::class)`) for isolated testing.
What are the alternatives to this package for graph algorithms in Laravel?
Alternatives include `undergraph/undergraph` (more visualization-focused) or `jenssegers/agent` (for web crawling graphs). However, this package is specialized for high-performance graph computations with typed APIs, making it ideal for citation networks or pathfinding in Laravel.
How do I handle edge weights or custom attributes in graphs?
Edge weights must be accessible via array keys (e.g., `$attrs['distance']`). If your graph uses custom attribute formats, write a mapper function to normalize them before passing the graph to algorithms like Dijkstra or A*.
Is there built-in support for real-time graph visualization (e.g., D3.js)?
No, this package focuses solely on computation. For visualization, you’ll need to integrate with libraries like D3.js or GraphQL subscriptions separately. The package provides typed results (e.g., `PathResult`) that you can serialize for frontend use.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
cadot.eu/make
besmartand-pro/php-quality-config
sentix/ai-chatbot
codifyo/ts-generator-bundle
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky