Welcome to my repository dedicated to advanced Graph Theory Algorithms, Disjoint Set Union (DSU) architectures, and Dynamic Programming (DP) strategies implemented in C++. This project catalogs implementations of classical network problems, traversal methodologies, and optimization paradigms.
The workspace is systematically divided into structural graph representations, foundational traversals, and specialized algorithm directories:
-
Adjacency_matrix.cpp—$\mathcal{O}(V^2)$ spatial density grid representations. -
Adjacency_list.cpp— Dynamic vector-of-lists mapping for optimal$\mathcal{O}(V + E)$ spatial footprints. -
edge_list.cpp— Linear vector serialization of individual structural edges. -
adj_list_to_matrix.cpp— Conversion pipelines transforming structural graph schemas. -
bfs_traversal.cpp&bfs_traversal_with_level_tracking.cpp— Queue-driven Breadth-First Searches for shortest-path routing in unweighted networks. -
path_printing.cpp— Backtracking traversals using parents mapping arrays to reconstruct explicit paths.
- Recursive explorations tracking tree-edge routing, component discoveries, and back-edge calculations.
- State-tracking arrays checking loop topologies inside directed and undirected networks.
- Priority-queue based greedy optimizations evaluating
$\mathcal{O}(E \log V)$ single-source shortest paths on positive-weighted paths.
- Iterative edge relaxation pipelines handling negative edge weights and identifying harmful negative cycles.
- Equivalence relation clustering featuring optimized path compression and union-by-rank heuristics.
- Optimal substructure breakdowns utilizing Memoization (Top-down) and Tabulation (Bottom-up) matrix mappings.
- Pathing & Navigation:
Can_Go.cpp,Can_Go_Again.cpp,Maze.cpp,Shortest_Distance.cpp. - Component Analytics:
Area_of_Component.cpp,Count_Apartments.cpp,Count_Apartments_II.cpp. - Network Optimization (MST):
Building.cpp,Emperor_Alexander.cpp,Cycle_of_Edges.cpp. - Knapsack & DP Variants:
Adventure.cpp,Chocolates.cpp,Exam_Marks.cpp,Make_It.cpp.
A compiler natively interpreting standard C++11 or higher is necessary (e.g., g++).
- Clone the algorithm ecosystem:
git clone github.com
- Access the execution root directory:
cd Algorithms - Compile your implementation file of choice (e.g., Dijkstra variant):
g++ dijkstra/dijkstra_implementation.cpp -o graph_demo
- Execute binaries:
- Windows:
graph_demo.exe - Linux/macOS:
./graph_demo
- Windows:
- Structural Graph Representations & Standard BFS/DFS
- Single-Source Shortest Paths (Dijkstra / Bellman-Ford)
- Minimum Spanning Trees (Kruskal's via DSU / Prim's)
- Classic DP Paradigms (0-1 Knapsack, Unbounded Knapsack, Longest Common Subsequence)