Shortest path found

This commit is contained in:
Ian Roddis
2021-06-02 13:55:12 -03:00
parent e64361c864
commit 44585ed339
2 changed files with 30 additions and 38 deletions

View File

@@ -5,10 +5,20 @@
#include "catch.hpp"
TEST_CASE("DAG Basic Tests", "[dag]") {
daggy::DAG<int, std::string> dag;
daggy::DAG<int> dag;
dag.addVertex(0, "hello");
dag.addVertex(1, "goodbye");
dag.addVertex(0);
for (int i = 1; i < 10; ++i) {
dag.addVertex(i);
dag.addEdge(i-1, i);
}
dag.addEdge(0, 1);
dag.addEdge(5, 9);
auto sp = dag.shortest_path(1,9);
std::cout << "Shortest path from 1 to 10: (";
for (auto k : sp) {
std::cout << k << " -> ";
}
std::cout << std::endl;
}