Implementation of Single Source Shortest Path Problem#317
Open
RajNilkar wants to merge 21 commits into
Open
Conversation
Merging CSharpAPI branch into shortestpath
Now the unit tests problems include SPADE parsing for directed graphs
User can pick their start and target node
Tracks the current node in a different color when going through each step
Adds the previous solution to the visualization for comparison.
Added new feature for step-viz
Merging upstream CSharpAPI branch into origin algtesting
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
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-Hardcategory 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 instancesSSSPVerifier.cs— validates submitted certificates against the problem instanceSSSPVisualization.cs— graph visualization, solved-path highlighting, and step-by-step visualization of Dijkstra's executionSSSP_Tests.cs) covering:Category placement: SSSP is correctly placed under
Problems/P/P_SSSP/, matching the platform's existingP_DFA/P_NFAconventionFixed: Verifier lookup fails for all
P/NP-HardproblemsWhy verifiers broke:
VerifierNavigationData.Find()(used byNav_Verifiers.cs/Problem_VerifiersRefactorController) has no equivalent fallback — it strictly filters byproblemTypePrefix, and returns nothing if the prefix doesn't match. This made verifiers unreachable for every problem outside the originalNPCompletecategory, 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 byproblemTypePrefixreturns no results, it retries matching onproblemNamealone, mirroring the existing solver/visualization fallback behavior.Testing
P/NP-Hardproblems by the same mechanism (confirmed via direct endpoint testing)dotnet test)