Hierarchical Pathfinding

A Rust crate to find Paths on a Grid using HPA* (Hierarchical Pathfinding A*) and Hierarchical Dijkstra.

Build Status Tests: CircleCI

Description

Provides a faster method of finding Paths on a Grid-like structure than regular Pathfinding algorithms. This is achieved by caching segments of Paths that form a higher order Node Graph. Finding a Path in that Graph is considerably faster than traversing all the tiles of the Grid individually, at the cost of producing Paths that are slightly worse than the optimal Path.

Advantages

Disadvantages

Example

The Setup

In order to calculate a Path from Start to End using regular A*, it is necessary to check a lot of Tiles:

A*

(This is simply a small example, longer Paths require a quadratic increase in Tile checks, and unreachable Goals require the check of every single Tile)

The Solution that Hierarchical Pathfinding provides is to divide the Grid into Chunks and cache the Paths between Chunk entrances as a Graph of Nodes:

The Graph

This allows Paths to be generated by connecting the Start and End to the Nodes within the Chunk and using the Graph for the rest:

The Solution