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

Fix inconsistent index and count when removing vertex from Graph. #451

Merged
merged 2 commits into from
May 5, 2024

Conversation

AngLv
Copy link
Contributor

@AngLv AngLv commented May 5, 2024

DirectedWeightedGraph.RemoveVertex decrements the Count property, but keeps the index of vertex array and adjacency matrix. The inconsistent index and count cause issue when adding new vertex after removing vertex.

This PR resolves the issue and fixes #368.

  • I have performed a self-review of my code
  • My code follows the style guidelines of this project
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Comments in areas I changed are up to date
  • I have added comments to hard-to-understand areas of my code
  • I have made corresponding changes to the README.md

@AngLv AngLv requested a review from siriak as a code owner May 5, 2024 05:15
Copy link
Member

@siriak siriak left a comment

Choose a reason for hiding this comment

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

Looks good, thanks!

@siriak siriak merged commit d28baa3 into TheAlgorithms:master May 5, 2024
2 checks passed
@AngLv AngLv deleted the bugfix branch May 6, 2024 06:41
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.

There is an issue in DirectedWeightedGraph.RemoveVertex
2 participants