TheAlgorithms / C-Sharp

All algorithms implemented in C#.
GNU General Public License v3.0
7.12k stars 1.52k forks source link

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

Closed AngLv closed 6 months ago

AngLv commented 6 months ago

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.