Skip to content

Conversation

holinkasa
Copy link

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:

  • Created a Disjoint Set Union (DSU) data structure with rank and path compression
  • Implemented edge sorting and selection algorithm
  • Added visited[] array to track edge visits
  • Developed function to calculate minimum total weight of the MST
  • Ensured handling of undirected graphs with non-negative edge weights

Test Cases

  • Verify DSU data structure correctly merges and finds sets
  • Check edge sorting works correctly for weighted edges
  • Validate MST algorithm finds minimum total weight
  • Ensure no self-loops or multiple edges are processed
  • Test handling of graphs with different numbers of vertices
  • Verify path compression in DSU reduces time complexity
  • Check visited[] array tracks edge visits correctly

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.

Implements koii-network#12953

Implements koii-network#12942

Implements koii-network#12926

Implements koii-network#12916

Implements koii-network#12885

Implements koii-network#12820

Implements koii-network#12741

Implements koii-network#12740

Implements koii-network#12718

Implements koii-network#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:
- Created a Disjoint Set Union (DSU) data structure with rank and path compression
- Implemented edge sorting and selection algorithm
- Added visited[] array to track edge visits
- Developed function to calculate minimum total weight of the MST
- Ensured handling of undirected graphs with non-negative edge weights

## Test Cases
 - Verify DSU data structure correctly merges and finds sets
 - Check edge sorting works correctly for weighted edges
 - Validate MST algorithm finds minimum total weight
 - Ensure no self-loops or multiple edges are processed
 - Test handling of graphs with different numbers of vertices
 - Verify path compression in DSU reduces time complexity
 - Check visited[] array tracks edge visits correctly

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.
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.

1 participant