The FastMap Algorithm for Shortest Path Computations

Liron Cohen, Tansel Uras, Shiva Jahangiri, Aliyah Arunasalam, Sven Koenig, T. K. Satish Kumar

Abstract

Finding shortest paths in large-scale graphs is a critical challenge in artificial intelligence. While A search improves upon Dijkstra's algorithm by using heuristics, generating high-quality heuristics for general graphs often involves a trade-off between preprocessing time and memory usage. This paper introduces an adaptation of the FastMap algorithm to embed graph nodes into a $K$-dimensional Euclidean space in near-linear time. By modifying the coordinate calculation and employing the $L_1$ (Manhattan) distance, the authors provide a consistent and admissible heuristic that significantly accelerates A search on complex graphs, such as those found in video game navigation and motion planning.

Introduction

Shortest-path computation is foundational for tasks ranging from robotic motion planning to social network analysis. A* search optimizes this process using a heuristic function $h(n)$ to estimate the remaining distance to the goal. However, for general graphs lacking an inherent geometric structure, finding an effective heuristic is difficult. Existing approaches like Differential Heuristics (DH) or Semidefinite Programming (SDP) either lack a true geometric embedding or suffer from prohibitive $O(N^2)$ memory or $O(N^3)$ preprocessing costs. This work proposes a "middle ground": a high-quality geometric embedding that scales linearly with the number of nodes.

The FastMap Algorithm for Graphs

The core contribution is the adaptation of FastMap, a data-mining technique originally used for dimensionality reduction and visualization. The algorithm proceeds through three main stages:

1. Pivot Selection

The algorithm identifies two "pivots," $O_a$ and $O_b$, which are heuristically chosen to be the most distant nodes in the graph.

2. Projection

Every node $O_i$ in the graph is projected onto the line connecting the two pivots. Using the Law of Cosines, the first coordinate $x_i$ for each node is calculated based on the distances between the pivots and the node.

Projection of node $O_i$ onto the line between pivots $O_a$ and $O_b$ using the Law of Cosines.

3. Recursion and Multi-dimensional Embedding

To capture more complex structures, the process is repeated. The "effective" distances between nodes are updated by subtracting the distance accounted for by the previous dimension. This allows the algorithm to find subsequent coordinates ($x_2, x_3, \dots, x_K$) in a recursive fashion.

Recursive projection of nodes into a new distance space $D_{new}$ to form a multi-dimensional embedding.

Ensuring Admissibility and Consistency

For A search to be optimal, the heuristic must be admissible (never overestimating the actual distance) and consistent (satisfying the triangle inequality). Standard FastMap uses $L_2$ distance, which does not guarantee these properties for general graphs. The authors modified the coordinate formula and switched to the $L_1$ (Manhattan) distance* metric. This mathematical refinement ensures the embedding provides a "safe" and efficient heuristic for optimal pathfinding.

Experimental Results

The authors evaluated the FastMap (FM) heuristic on benchmark maps from the Moving AI Lab, including complex environments from Dragon Age: Origins:

  • Performance: FM significantly outperformed traditional heuristics like Octile distance.
  • Scalability: The near-linear preprocessing time allowed FM to handle massive maps, such as a maze with over 250,000 nodes, where cubic-time methods would fail.
  • Complementary Strengths: FM was found to be competitive with Differential Heuristics. Interestingly, combining FM with DH by taking the maximum of their estimates resulted in a "super-heuristic" that surpassed both individual methods.

Conclusion

The adapted FastMap algorithm provides a scalable and mathematically sound method for generating heuristics in complex graphs. While it excels in open or "natural" terrains that approximate low-dimensional manifolds, future work is needed to improve performance in high-intrinsic-dimension environments like artificial mazes and to extend the consistency proofs to directed graphs.

Summary updated

BibTeX
@inproceedings{cohen2018fastmap,
  author = {Liron Cohen and Tansel Uras and Shiva Jahangiri and Aliyah Arunasalam and Sven Koenig and T. K. Satish Kumar},
  title = {{The FastMap Algorithm for Shortest Path Computations}},
  booktitle = {ISAIM},
  year = {2018},
  url = {https://openreview.net/forum?id=8ZxA1TC7-2g},
}
Figure