# qiao/pathfinding.js

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/qiao-pathfinding-js).**

8,701 stars · 1,361 forks · JavaScript

## Links

- GitHub: https://github.com/qiao/PathFinding.js
- Homepage: http://qiao.github.io/PathFinding.js/visual/
- awesome-repositories: https://awesome-repositories.com/repository/qiao-pathfinding-js.md

## Description

PathFinding.js is a grid-based pathfinding library that implements multiple search algorithms for computing optimal routes on 2D maps. It provides implementations of A*, Dijkstra, Breadth-First Search, and Jump Point Search, each designed to find the shortest path between two points on a grid while avoiding obstacles.

The library is built around a pluggable architecture where each pathfinding strategy shares a common interface, allowing algorithms to be selected at runtime without modifying core logic. It includes a configurable diagonal movement rule engine that controls diagonal traversal based on adjacent obstacle counts, and supports heuristic-driven search to balance optimality and performance. Jump Point Search optimization is available for uniform-cost grids, pruning symmetric paths to reduce node expansions in open areas.

The system represents the search space as a 2D grid of walkable and blocked cells, with support for defining obstacles at individual coordinates or across entire matrices. It offers algorithm selection from multiple strategies, diagonal movement control with configurable rules, movement restriction to cardinal directions only, and grid cloning to preserve original maps after pathfinding operations. Node pooling is used to reuse objects across searches, reducing memory allocation overhead in repeated calls.

## Tags

### Artificial Intelligence & ML

- [Grid Pathfinding](https://awesome-repositories.com/f/artificial-intelligence-ml/machine-learning/frameworks/reinforcement-learning-environments/grid-world-simulation-frameworks/game-world-pathfinding/grid-pathfinding.md) — A library that computes shortest routes on 2D grids using multiple search algorithms like A* and Dijkstra.
- [Jump Point Search Pathfinding](https://awesome-repositories.com/f/artificial-intelligence-ml/machine-learning/frameworks/reinforcement-learning-environments/grid-world-simulation-frameworks/game-world-pathfinding/grid-pathfinding/jump-point-search-pathfinding.md) — Accelerates pathfinding on uniform-cost grids by skipping large open areas with Jump Point Search.
- [Obstacle Definitions](https://awesome-repositories.com/f/artificial-intelligence-ml/machine-learning/frameworks/reinforcement-learning-environments/grid-world-simulation-frameworks/game-world-pathfinding/grid-pathfinding/obstacle-definitions.md) — Allows marking cells as blocked or walkable to define the navigable space for pathfinding.
- [Grid-Based State Representations](https://awesome-repositories.com/f/artificial-intelligence-ml/markovian-state-representations/grid-based-state-representations.md) — Represents the search space as a 2D grid of walkable and blocked cells for pathfinding.
- [Pathfinding Algorithm Selection](https://awesome-repositories.com/f/artificial-intelligence-ml/model-selection-tools/automated-selection/model-performance-selection/algorithm-and-hyperparameter-selection/pathfinding-algorithm-selection.md) — Allows selection from multiple pathfinding strategies including A*, Dijkstra, Breadth-First, and Jump Point Search. ([source](https://cdn.jsdelivr.net/gh/qiao/pathfinding.js@master/README.md))

### Education & Learning Resources

- [Grid Pathfinding](https://awesome-repositories.com/f/education-learning-resources/educational-resources/algorithms-theory-academics/cs-theory-foundations/algorithms/data-ordering-and-retrieval/breadth-first-search/grid-pathfinding.md) — Implements Breadth-First Search for finding shortest paths on unweighted grid maps.
- [Dijkstra Implementations](https://awesome-repositories.com/f/education-learning-resources/path-optimization-algorithms/weighted-graph-path-optimizations/dijkstra-implementations.md) — Implements Dijkstra's algorithm for finding shortest paths on weighted or unweighted grids.

### Game Development

- [Diagonal Movement Rules](https://awesome-repositories.com/f/game-development/grid-based-alignment-systems/movement-translation/diagonal-movement-rules.md) — Controls diagonal movement based on configurable rules evaluating adjacent obstacle counts. ([source](http://pathfindingjs.readthedocs.org/en/latest/user-guide/diagonal-movement/))

### Hardware & IoT

- [Grid Obstacle Definitions](https://awesome-repositories.com/f/hardware-iot/autonomous-flight-controllers/obstacle-avoidance-systems/grid-obstacle-definitions.md) — Provides the core mechanism for defining navigable space by marking grid cells as obstacles. ([source](http://pathfindingjs.readthedocs.org/en/latest/user-guide/obstacles/))

### Scientific & Mathematical Computing

- [Heuristic Graph Search Algorithms](https://awesome-repositories.com/f/scientific-mathematical-computing/heuristic-graph-search-algorithms.md) — Uses cost-plus-heuristic evaluation functions to guide node expansion in pathfinding algorithms.
- [Jump Point Search Optimizations](https://awesome-repositories.com/f/scientific-mathematical-computing/jump-search-algorithms/jump-point-search-optimizations.md) — Implements Jump Point Search to prune symmetric paths and reduce node expansions on uniform-cost grids.
- [A-Star Search](https://awesome-repositories.com/f/scientific-mathematical-computing/numerical-mathematical-foundations/algorithms-and-complexity/algorithms/graph-processing/shortest-path-algorithms/a-star-search.md) — Implements the A* search algorithm for finding optimal paths on grid-based maps.
- [Pathfinding Algorithms](https://awesome-repositories.com/f/scientific-mathematical-computing/numerical-mathematical-foundations/algorithms-and-complexity/pathfinding-algorithms.md) — Implements Dijkstra's algorithm for finding shortest paths by exploring cells in order of increasing distance.
- [Jump Point Search Pathfinding](https://awesome-repositories.com/f/scientific-mathematical-computing/numerical-mathematical-foundations/algorithms-and-complexity/pathfinding-algorithms/jump-point-search-pathfinding.md) — Speeds up A* by skipping large open areas on uniform-cost grids using Jump Point Search.

### Security & Cryptography

- [Cardinal](https://awesome-repositories.com/f/security-cryptography/field-level-read-restrictions/input-modification-restrictions/movement-restrictions/cardinal.md) — Disables diagonal traversal so the pathfinder only moves in cardinal directions on the grid. ([source](http://pathfindingjs.readthedocs.org/en/latest/user-guide/diagonal-movement/))

### Software Engineering & Architecture

- [Plugin-Based Architectures](https://awesome-repositories.com/f/software-engineering-architecture/software-architecture/architectural-patterns/plugin-module-systems/modular-plugin-architectures/plugin-based-architectures/plugin-based-architectures.md) — Implements a pluggable architecture where each pathfinding strategy is a swappable module sharing a common interface.

### User Interface & Experience

- [Grid Diagonal Movement Rules](https://awesome-repositories.com/f/user-interface-experience/element-positioning/movement-constraints/grid-diagonal-movement-rules.md) — Provides a configurable diagonal movement rule engine that controls traversal based on adjacent obstacle counts.
