Skip to content

Update dijkstra.cpp #2958

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

krishnaawasthi-26
Copy link

Description of Change

Added input validation for edge cases in Dijkstra’s algorithm implementation.

Specifically, handled the following conditions:

If vertices <= 0, output a message and terminate.

If edges < 0, output a message and terminate.

If edges == 0, output that all nodes are isolated and terminate.

These changes improve the robustness of the program by preventing invalid graph input scenarios and providing informative user feedback.

@krishnaawasthi-26
Copy link
Author

please all this ---- Fixes #2958

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.

1 participant