Skip to content

C++ implementation of Prim's Minimum Spanning Tree Algorithm #685

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
Jul 1, 2025

Conversation

prex03
Copy link
Contributor

@prex03 prex03 commented Jun 25, 2025

This PR adds:

  1. C++ implementation of Prim's MST algorithm using a priority queue on adjacency list graphs.
  2. std::variant-based edge values in GraphEdge, replacing PyObject* for better type safety and performance.
  3. Includes tests to verify MST correctness and edge value handling.

@prex03 prex03 force-pushed the feature/prim-mst branch from cb1cb7d to 4ad27aa Compare June 25, 2025 15:38
@prex03 prex03 force-pushed the feature/prim-mst branch from 85f13d5 to 95795cc Compare June 25, 2025 15:58
@czgdp1807
Copy link
Member

Conflicts need to be resolved here. @prex03 Please complete it.

@prex03
Copy link
Contributor Author

prex03 commented Jul 1, 2025

Conflicts need to be resolved here. @prex03 Please complete it.

Done.

@czgdp1807
Copy link
Member

Points to be considered,

  1. Try abseil containers, instead of std::unordered_map, std::unordered_set.
  2. Use, integer IDs in C++ backend for algorithms instead of std::string names.
  3. Find a better representation for undirected graphs (right now in AdjacencyListGraph, a -- b is represented via {a: [b], b: [a]}

@czgdp1807 czgdp1807 merged commit 7a1e4cb into codezonediitj:main Jul 1, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants