Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
mat_path_example.cc File Reference

Educational examples for path reconstruction from distance matrices. More...

#include <iostream>
#include <tpl_graph.H>
#include <tpl_dynArray.H>
Include dependency graph for mat_path_example.cc:

Go to the source code of this file.

Functions

int main ()
 

Detailed Description

Educational examples for path reconstruction from distance matrices.

WHAT IS PATH RECONSTRUCTION?

After running Floyd-Warshall all-pairs shortest paths algorithm, you get a distance matrix D[i][j] = shortest distance from i to j But how do you get the ACTUAL PATH?

SOLUTION: Path matrix P[i][j]

During Floyd-Warshall, maintain P[i][j] = intermediate node on path Then recursively reconstruct the path from P matrix

WHY IT MATTERS:

Distance alone isn't enough - you need the route! GPS needs: "Turn left, then right" not just "10 miles away"

COMPILE & RUN:

g++ -std=c++20 -I.. -o mat_path_example mat_path_example.cc ./mat_path_example

Definition in file mat_path_example.cc.

Function Documentation

◆ main()

int main ( )

Definition at line 34 of file mat_path_example.cc.

References Aleph::maps(), and N.