Skip to content
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

Add largest connected component method #1562

Merged
merged 12 commits into from
Apr 14, 2024

Conversation

D4rkisek
Copy link
Contributor

@D4rkisek D4rkisek commented Apr 9, 2024

What changes were proposed in this pull request?

This pull request introduces a method that extracts the largest connected component from a graph. The method, utilises the weakly connected components algorithm to identify and return the largest connected component as a new sub-graph.

Why are the changes needed?

Resolves an issue.

Does this PR introduce any user-facing change? If yes is this documented?

Yes, it adds a new algorithm method that is exposed through the graph.rs API. While this change is currently not documented, I am prepared to provide documentation upon request.

How was this patch tested?

Unit tests, in Python and Rust: tested against an empty graph, single connected component, multiple connected components, and same size connected components.

Issues

resolves#1214

Are there any further changes required?

Return a neater warning message when there are two or more largest connected components. Can do that upon request.

Copy link
Collaborator

@miratepuffin miratepuffin left a comment

Choose a reason for hiding this comment

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

Looks great! A minor optimisation for the way you get the LCC and this can go in.

Thanks again for contributing

@D4rkisek D4rkisek requested a review from miratepuffin April 13, 2024 18:19
@miratepuffin miratepuffin merged commit 22d0a1d into Pometry:master Apr 14, 2024
13 checks passed
fabianmurariu pushed a commit that referenced this pull request May 21, 2024
* Add largest connected component method

* Expose lcc to python

* Expose lcc to python

* optimise the function

* run cargo +nightly fmt

* Missed a bracket on the merge

* run cargo +nightly fmt

---------

Co-authored-by: Ben Steer <b.a.steer@qmul.ac.uk>
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