Skip to content

Add Dijkstra’s algorithm implementation in Python #2410

@Harushii16

Description

@Harushii16

🚀 Feature Request

Please add an implementation of Dijkstra’s shortest path algorithm in Python to this repository.

🔍 Why this is useful

  • Dijkstra’s algorithm is a well-known graph algorithm and a useful example for learners.
  • Having it in Python increases the variety of languages supported in this repo.
  • Contributors can refer to it and extend with weighted graphs, test cases, etc.

📦 What to include

  1. A file python/dijkstra.py (or under appropriate “Python” directory) with a clean, readable implementation.
  2. Optionally, a README or comment block explaining usage (input format, how to call it, complexity).
  3. A simple example/test case inside the same file or separate test_dijkstra.py or example in comments.
  4. (Optional) Add entry in README.md listing “Python: dijkstra.py” under Python section or code index.

✅ Acceptance Criteria

  • The algorithm handles graphs represented via adjacency lists or dictionaries.
  • Works for non-negative weights.
  • Example usage is documented.
  • Code is clean, commented.
  • Doesn’t break any existing contributions or project structure.

If maintainers are okay with this, I’ll prepare a PR with the implementation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions