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

Closed

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

@realstealthninja
Copy link
Collaborator

realstealthninja commented Jul 9, 2025

It would be preferred if main functions only contained a call to tests and nothing else.

You could add tests for these edge cases into the tests function

Copy link
Contributor

github-actions bot commented Aug 9, 2025

This pull request has been automatically marked as abandoned because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale Author has not responded to the comments for over 2 weeks label Aug 9, 2025
Copy link
Contributor

Please ping one of the maintainers once you commit the changes requested or make improvements on the code. If this is not the case and you need some help, feel free to ask for help in our Gitter channel or our Discord server. Thank you for your contributions!

@github-actions github-actions bot closed this Aug 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Author has not responded to the comments for over 2 weeks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants