Skip to content

Add A* (A-Star) Pathfinding Algorithm Implementation #13917

@vivekkumarrathour

Description

@vivekkumarrathour

Feature description

Feature Description

The repository currently contains various graph traversal algorithms (BFS, DFS, Dijkstra) but lacks the A* (A-Star) pathfinding algorithm, which is one of the most widely used pathfinding algorithms in computer science, game development, robotics, and AI applications.

Proposed Implementation

I propose adding an A* pathfinding algorithm implementation in the graphs/ directory with the following features:

  1. Core A algorithm* with configurable heuristic functions
  2. Support for weighted graphs (grid-based and adjacency list representations)
  3. Multiple heuristic functions:
    • Manhattan distance (for grid-based pathfinding)
    • Euclidean distance
    • Chebyshev distance
  4. Comprehensive doctests demonstrating various use cases
  5. Type hints for all function parameters and return values
  6. Clear documentation with examples and complexity analysis

Why This Enhancement?

  • A* is a fundamental algorithm taught in AI and algorithms courses
  • It's widely used in real-world applications (GPS navigation, game AI, robotics)
  • Complements existing graph algorithms in the repository
  • Provides educational value for learners understanding informed search algorithms

Example Use Cases

  • Grid-based pathfinding (game maps, mazes)
  • Route planning in weighted graphs
  • Robot navigation
  • Comparison with uninformed search algorithms (BFS, DFS)

Benefits

  • Educational resource for students learning AI and graph algorithms
  • Practical implementation that can be used in real projects
  • Demonstrates the difference between informed and uninformed search strategies

I would be happy to implement this feature following the repository's contributing guidelines if approved.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementThis PR modified some existing files

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions