Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
在rust的邻接表实现图的程序中,对于添加边(或删除边)缺少了确认边存在(或不存在)。这会导致如果出现边存在的情况下添加边导致列表中存在重复的边。
![截图 2024-06-29 00-45-26](https://private-user-images.githubusercontent.com/87167211/344248825-c6c95351-21f7-4e23-8902-0a819a7f5496.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU1NjUyODMsIm5iZiI6MTcyNTU2NDk4MywicGF0aCI6Ii84NzE2NzIxMS8zNDQyNDg4MjUtYzZjOTUzNTEtMjFmNy00ZTIzLTg5MDItMGE4MTlhN2Y1NDk2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA5MDUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwOTA1VDE5MzYyM1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWUzNTVkNmMxOThlMTIwMjEyMGFhNzZiM2VlY2VlNmQ5MmNiNWFhMGNlY2EzYzUxZTc3MjJiN2IzZmNmZjZjZDUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.wRGDFDMhdUlG51iqAcjtxQ8E_F_a1rpqzVzt3Goolps)
添加一个判定后可避免该结果的产生