- 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.