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
Fix random_spanning_tree() for single node and empty graphs #7211
Fix random_spanning_tree() for single node and empty graphs #7211
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this can be done in a more compact way. Probably the tests too, but not as important. I suggest another test below also.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @nihalgeorge01 , and @Schefflera-Arboricola and @dschult for review!
Partial fix for issue #6920 for random_spanning_tree() by checking explicitly for empty and single node graphs. Earlier, the main for loop was the only return path, and these edge cases would cause an Exception meant for trees with less edges.