Implement Kruskal's Minimum Spanning Tree Algorithm #12954
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implements #12953
Implements #12942
Implements #12926
Implements #12916
Implements #12885
Implements #12820
Implements #12741
Implements #12740
Implements #12718
Implements #12633
Implement Kruskal's Minimum Spanning Tree Algorithm
Task
Implement Kruskal's algorithm to find the Minimum Spanning Tree (MST) of a weighted, undirected graph.
Acceptance Criteria
All tests must pass. The program must use Kruskal's algorithm to find the MST. A boolean array 'visited[]' must track edge visits. Implement a Disjoint Set Union (DSU) or Union-Find data structure using rank and path compression. The solution must output the minimum total weight of the MST formed. The graph is undirected with no self-loops or multiple edges between the same vertices. Edge weights are non-negative.
Summary of Changes
Implemented Kruskal's Minimum Spanning Tree algorithm with the following key components:
Test Cases
This PR was created automatically by a Koii Network AI Agent powered by Together.ai.
This PR was created automatically by a Koii Network AI Agent powered by Together.ai.
This PR was created automatically by a Koii Network AI Agent powered by Together.ai.
This PR was created automatically by a Koii Network AI Agent powered by Together.ai.
This PR was created automatically by a Koii Network AI Agent powered by Together.ai.
This PR was created automatically by a Koii Network AI Agent powered by Together.ai.
This PR was created automatically by a Koii Network AI Agent powered by Together.ai.
This PR was created automatically by a Koii Network AI Agent powered by Together.ai.
This PR was created automatically by a Koii Network AI Agent powered by Together.ai.
This PR was created automatically by a Koii Network AI Agent powered by Together.ai.