-
Notifications
You must be signed in to change notification settings - Fork 42
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
[ALGO] Borůvka's algorithm #113
Comments
Hi, I have some experience with C++ and would like to tak a part in this project! I find this a good first issue since it’s fairly known what needs to be done and since I’m Czech, I have access to many original materials about Borůvka. Therefore, I’d like to try and implement this, if possible. I’m also taking part as a Hacktoberfest attendee |
Hi Harry, welcome to Graaf! |
Awesome, thank you! |
Hi @bobluppes, just wanted to make an update. I've been busy with work and studies so I haven't been able to get to this yet, but I hope to get to it at the end of the upcoming week. Just wanted to inform that I indeed am thinking about this, just haven't had much time to fully get into it yet. Sorry for that! |
Hi @HarryHeres, no problem! |
@bobluppes I finally got some time to realize this. As I'm working, I had an idea. Wouldn't it be better to differentiate the return values a bit? For example, we could return a NULL value if the provided graph is invalid (e.g. null pointer or 0 vertices or 0 edges). Otherwise, if the MST just was not computable, we could then return an empty vector. I believe this would benefit the user of a bit more knowledge of what happend? Also, under the type GRAPH, what do we expect the user to put in? I suppose something like I'm not a C++ dev mainly so I might have a completely wrong view on this. |
Hi @HarryHeres, these are some good remarks! Regarding the Regarding the return value, the reasoning for the proposed interface is that we can either compute a MST for the graph, or there is no MST (for example due to the graph not being spannable). Therefore we either return a non-empty vector or an empty one. Do you see a different reason as to why we can not compute a MST? If we want to make it more explicit that we did not find a MST we could indeed differentiate this in the return value as you suggested. We could do this by returning an |
Awesome, thank you for your input! Regarding the return values - std::optional is definitely an interesting choice. You do have a point with the MST calculation being basically either possible or not. For the time being, I will leave it as it was intended, if there's any other state I would run into, we could discuss further if we should introduce a more sophisticated pattern :) Does that sound OK? |
Thanks, that sounds fine by me! I think it would make sense to do a follow up and change the interface of the MST functions to return an empty optional if no tree was found. Then the return value semantics are more clear for the user. But let’s continue like this and discuss further in a follow up 👍🏻 |
Stale issue message |
@bobluppes Can we reopen? I was quite busy lately |
Stale issue message |
Unstale |
Stale issue message |
Borůvka's algorithm
Borůvka's algorithm, also known as Sollin's algorithm, is a classic approach to find the Minimum Spanning Tree (MST) of a graph. It works well for disconnected graphs by finding a Minimum Spanning Forest. This algorithm is unique in the way it handles edge selections, and it can be highly efficient for sparse graphs.
More details can be found on the wikipedia entry.
Syntax
The algorithm should have the following syntax:
This should live in the
graaf::algorithm
namespace underinclude/graaflib/algorithm/minimum_spanning_tree/boruvka.h
.Definition of Done
This issue is done when:
test/graaflib/algorithm/minimum_spanning_tree/boruvka_test.cpp
docs/docs/algorithms
under the appropriate categoryREADME.md
The text was updated successfully, but these errors were encountered: