Skip to content

Conversation

shimmer12
Copy link
Contributor

Implemented Kruskal's algorithm to find the Minimum Spanning Tree (MST) of a connected, weighted, undirected graph.

Utilizes Disjoint Set Union (Union–Find) with path compression and union by rank for efficient edge merging.

Accepts edge list input (u, v, w) and number of vertices n.

Returns both the total weight and the edges included in the MST.

Added a simple example demonstrating usage with a 4-node graph.

Written in base R, with no external dependencies, consistent with repository standards.

@shimmer12 shimmer12 requested a review from siriak as a code owner October 11, 2025 21:09
@Copilot Copilot AI review requested due to automatic review settings October 11, 2025 21:09
@shimmer12 shimmer12 requested a review from acylam as a code owner October 11, 2025 21:09
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements Kruskal's algorithm for finding Minimum Spanning Trees (MST) in weighted undirected graphs. The implementation uses a Disjoint Set Union data structure with path compression and union by rank optimization for efficient cycle detection.

Key changes:

  • Adds complete MST algorithm with Union-Find data structure
  • Includes comprehensive example demonstrating usage on a 4-vertex graph
  • Follows repository standards with base R implementation and no external dependencies

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Copilot Copilot AI review requested due to automatic review settings October 11, 2025 21:11
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Copilot Copilot AI review requested due to automatic review settings October 11, 2025 21:14
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

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