How arpitmurailya18/path-pivot works
Purpose and Runtime
Path & Pivot is a native C++ desktop algorithm visualizer. It uses SFML for its window, rendering, input, timing, and likely text/UI primitives; SFML headers and static/shared libraries are vendored under External/include/SFML and External/lib. Prebuilt Windows executables exist at sfml work/main.exe and sfml work/PathandPivot.exe.
Application Entry and Mode Routing
The executable entry point is sfml work/main.cpp. It likely owns the SFML event/render loop and dispatches between the two primary experiences: sorting visualization and grid/pathfinding visualization. sfml work/src/Homepage.cpp and sfml work/src/Homepage.h define the landing or mode-selection boundary.
Shared Visualization Control Layer
The application is interactive rather than batch-oriented: user events control play/pause, reset, generation, speed, and algorithm selection. Rendering colors/states are centralized in sfml work/src/VisualizerColor.h; algorithm-facing explanatory UI is represented by sfml work/src/Pseudocode.h. This layer separates visual state and controls from the algorithm implementations.
Sorting Pipeline
Sorting operates over a one-dimensional generated array, updating visual frames and collecting run metrics such as comparisons and array accesses. Each sorting strategy is independently implemented behind paired source/header units:
• sfml work/src/BubbleSort.cpp, sfml work/src/BubbleSort.h
• sfml work/src/InsertionSort.cpp, sfml work/src/InsertionSort.h
• sfml work/src/MergeSort.cpp, sfml work/src/MergeSort.h
• sfml work/src/QuickSort.cpp, sfml work/src/QuickSort.h
• sfml work/src/SelectionSort.cpp, sfml work/src/SelectionSort.h
The key boundary is algorithm mutation/instrumentation versus the SFML-driven presentation loop, allowing execution progress to be visualized in real time.
Grid and Maze Model
Pathfinding runs over a two-dimensional grid model defined by sfml work/src/Grid.cpp and sfml work/src/Grid.h. The grid is the shared domain object for user-authored walls/weights, start and destination positions, traversal markings, and reconstructed paths. sfml work/src/MazeGenerator.cpp and sfml work/src/MazeGenerator.h generate maze layouts that feed the same grid model, rather than being a separate pathfinding representation.
Pathfinding Pipeline
Pathfinding algorithms consume the grid state, progressively mark search/frontier results, then report outcomes such as nodes visited and path cost. Implementations are isolated by algorithm:
• sfml work/src/BFS.cpp, sfml work/src/BFS.h
• sfml work/src/DFS.cpp, sfml work/src/DFS.h
• sfml work/src/Dijkstra.cpp, sfml work/src/Dijkstra.h
• sfml work/src/Astar.cpp, sfml work/src/Astar.h
This provides a common visualization surface while preserving algorithm-specific traversal and cost behavior.
Dependencies and Delivery Boundary
There is no server, database, or external runtime service indicated. The application is a Windows-oriented local executable built with g++/MinGW, with SFML packaged in-repository. SFML itself brings graphics/windowing and optional audio/network facilities, though the repository’s architecture is centered on local graphical visualization rather than networked functionality.
Main entry points: Grid.cpp Grid Model · main.cpp Application Entry · Homepage.cpp Mode Selection · VisualizerColor.h Visual States
Components 16
Desktop Application
- Application Entry · Owns the SFML event and render loop.
sfml work/main.cpp - Mode Selection
sfml work/src/Homepage.cpp - Visualization Controls · Handles playback, reset, generation, speed, and algorithm choices.
- Visual States
sfml work/src/VisualizerColor.h - Algorithm Explanations
sfml work/src/Pseudocode.h
Sorting Visualization
- Array Visualization · Generated array, frame updates, comparisons, and accesses.
- Bubble Sort
sfml work/src/BubbleSort.cpp - Insertion Sort
sfml work/src/InsertionSort.cpp - Merge Sort
sfml work/src/MergeSort.cpp - Quick Sort
sfml work/src/QuickSort.cpp - Selection Sort
sfml work/src/SelectionSort.cpp
Pathfinding Visualization
- Grid Model · Stores walls, weights, endpoints, search markings, and paths.
sfml work/src/Grid.cpp - Maze Generator
sfml work/src/MazeGenerator.cpp - Pathfinding Algorithms · Progressively traverse and mark the shared grid.
Native Runtime
- SFML · Provides windowing, rendering, input, and timing.
External/include/SFML - Windows Executable
sfml work/PathandPivot.exe
Connections 17
- Application Entry → Mode Selection: starts at
- Mode Selection → Array Visualization: selects sorting
- Mode Selection → Grid Model: selects pathfinding
- Visualization Controls → Array Visualization: controls
- Visualization Controls → Grid Model: edits and runs
- Visual States → Array Visualization: colors frames
- Visual States → Grid Model: colors cell states
- Algorithm Explanations → Visualization Controls: explains selection
- Bubble Sort → Array Visualization: mutates and instruments
- Insertion Sort → Array Visualization: mutates and instruments
- Merge Sort → Array Visualization: mutates and instruments
- Quick Sort → Array Visualization: mutates and instruments
- Selection Sort → Array Visualization: mutates and instruments
- Maze Generator → Grid Model: generates layout
- Pathfinding Algorithms → Grid Model: traverses and reconstructs
- Application Entry → SFML: uses event and render runtime
- Application Entry → Windows Executable: builds to