PyVerse icon indicating copy to clipboard operation
PyVerse copied to clipboard

Added MST Algorithms to the Algorithms_and_Data_Structures folder #481

Open shashmitha46 opened this issue 1 year ago • 1 comments

Pull Request for PyVerse 💡

Requesting to submit a pull request to the PyVerse repository.


Issue Title

[Code Addition Request]: Add MST Algorithms

  • [x] I have provided the issue title.

Info about the Related Issue

What’s the goal of the project?
The goal of the project is to enhance the repository's graph algorithms section by implementing optimized versions of Prim's and Kruskal's algorithms to find the Minimum Spanning Tree (MST) in an undirected, weighted graph. These implementations will improve performance by using a priority queue in Prim’s algorithm and a disjoint set in Kruskal’s for cycle detection.

Describe the aim of the project.
The aim is to provide efficient and well-documented implementations of MST algorithms, ensuring that they handle edge cases (like disconnected graphs) and include unit tests for reliability. This will strengthen the graph algorithms section of the repository.

  • [x] I have described the aim of the project.

Name

Please mention your name.
Enter your name here. Shashmitha V

  • [x] I have provided my name.

GitHub ID

Please mention your GitHub ID.
Enter your GitHub ID here. https://github.com/shashmitha46

  • [x] I have provided my GitHub ID.

Email ID

Please mention your email ID for further communication.
Enter your email ID here. [email protected]

  • [x] I have provided my email ID.

Identify Yourself

Mention in which program you are contributing (e.g., WoB, GSSOC, SSOC, SWOC).
Enter your participant role here.

  • [x] I have mentioned my participant role.

Closes

Enter the issue number that will be closed through this PR.
*Closes: #481 *

  • [x] I have provided the issue number.

Describe the Add-ons or Changes You've Made

Give a clear description of what you have added or modified.
Describe your changes here. Added 3 MST algorithms

  1. prim's algorithm
  2. kruskal's algorithm
  3. using scipy
  • [x] I have described my changes.

Type of Change

Select the type of change:

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [ ] New feature (non-breaking change which adds functionality)
  • [x] Code style update (formatting, local variables)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] This change requires a documentation update

How Has This Been Tested?

Describe how your changes have been tested.
Describe your testing process here.
The changes have been tested using unit tests that cover various scenarios, including connected graphs, disconnected graphs, and edge cases like graphs with no edges or multiple minimum spanning trees. The tests ensure that both Prim’s and Kruskal’s algorithms correctly find the Minimum Spanning Tree and handle edge cases without errors.

  • [x] I have described my testing process.

Checklist

Please confirm the following:

  • [x] My code follows the guidelines of this project.
  • [x] I have performed a self-review of my own code.
  • [x] I have commented my code, particularly wherever it was hard to understand.
  • [x] I have made corresponding changes to the documentation.
  • [x] My changes generate no new warnings.
  • [x] I have added things that prove my fix is effective or that my feature works.
  • [x] Any dependent changes have been merged and published in downstream modules.

shashmitha46 avatar Oct 14 '24 18:10 shashmitha46

👋 Thank you for opening this pull request! We're excited to review your contribution. Please give us a moment, and we'll get back to you shortly!

Feel free to join our community on Discord to discuss more!

github-actions[bot] avatar Oct 14 '24 18:10 github-actions[bot]

Assign me if no one is reviewing this @UTSAVS26

ruhi47 avatar Oct 23 '24 20:10 ruhi47

Assign me if no one is reviewing this @UTSAVS26

Done

UTSAVS26 avatar Oct 24 '24 02:10 UTSAVS26