Skip to content

Implementation of Single Source Shortest Path Problem#317

Open
RajNilkar wants to merge 21 commits into
ReduxISU:CSharpAPIfrom
RajNilkar:algtesting
Open

Implementation of Single Source Shortest Path Problem#317
RajNilkar wants to merge 21 commits into
ReduxISU:CSharpAPIfrom
RajNilkar:algtesting

Conversation

@RajNilkar

Copy link
Copy Markdown
Contributor

Single Source Shortest Path (SSSP) Problem + Verifier Navigation Fix

Closes #165
Closes #171

Summary

This PR adds the Single Source Shortest Path (SSSP) problem to Redux, solved via Dijkstra's algorithm, and fixes a verifier-lookup bug uncovered while testing it against the new P / NP-Hard category structure.

This branch (algtesting) has been the team's shared working branch since March 8th and has not been merged upstream since then, so this PR also includes accumulated work from other contributors on the team over that period. The summary below focuses on the SSSP feature and the verifier fix; tagging contributors for visibility on the rest.


SSSP Problem Implementation

Problem definition: Given a weighted graph G = (V, E) with non-negative edge weights and a source vertex s, find the shortest path from s to every other vertex, where path length is the sum of edge weights along the path.

What's included:

  • SSSP_Class.cs — problem definition, instance parsing/validation (rejects negative weights and out-of-range source vertices)
  • SSSPSolver.cs — Dijkstra's algorithm implementation supporting both weighted and unweighted, directed and undirected graph instances
  • SSSPVerifier.cs — validates submitted certificates against the problem instance
  • SSSPVisualization.cs — graph visualization, solved-path highlighting, and step-by-step visualization of Dijkstra's execution
  • Test suite (SSSP_Tests.cs) covering:
    • Default/custom instantiation
    • Rejection of negative weights and invalid source vertices
    • Verifier accept/reject cases across directed/undirected and weighted/unweighted graphs
    • Solver correctness verified via the verifier (not exact-string matching, since Dijkstra may return any optimal path when ties exist)
    • Edge cases: unreachable target, source equal to target
    • Steps visualization rendering
      Category placement: SSSP is correctly placed under Problems/P/P_SSSP/, matching the platform's existing P_DFA / P_NFA convention

Fixed: Verifier lookup fails for all P / NP-Hard problems

Why verifiers broke: VerifierNavigationData.Find() (used by Nav_Verifiers.cs / Problem_VerifiersRefactorController) has no equivalent fallback — it strictly filters by problemTypePrefix, and returns nothing if the prefix doesn't match. This made verifiers unreachable for every problem outside the original NPComplete category, not just SSSP — confirmed reproducible on DFA, NFA, and the Pump Scheduling (NP-Hard) problem as well.

Fix applied (created a fallback): Added a fallback to VerifierNavigationData.Find() — if filtering by problemTypePrefix returns no results, it retries matching on problemName alone, mirroring the existing solver/visualization fallback behavior.

Testing

  • Verified locally: SSSP solve, verify, visualize, and step-by-step visualization all function correctly against multiple weighted/unweighted, directed/undirected test instances
  • Verified the verifier fix resolves the lookup failure for SSSP, and should resolve it for other P/NP-Hard problems by the same mechanism (confirmed via direct endpoint testing)
  • Full test suite passes (dotnet test)

@CLAassistant

CLAassistant commented Jun 21, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 4 committers have signed the CLA.

✅ RajNilkar
❌ MysticTiger2
❌ ScottBBarfuss
❌ malawitt
You have signed the CLA already but the status is still pending? Let us recheck it.

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.

[Bug]: SHORTESTPATH [Bug]: SHORTESTPATH error 500

5 participants