Add BFS tree
This commit is contained in:
@@ -1,23 +1,35 @@
|
||||
#include <doctest/doctest.h>
|
||||
|
||||
#include "graph/graph.h"
|
||||
#include "graph/scc.h"
|
||||
using namespace graph;
|
||||
#include "algorithm/tarjan.h"
|
||||
|
||||
TEST_SUITE("Graph test.") {
|
||||
TEST_SUITE("Graph.") {
|
||||
|
||||
TEST_CASE("Insertion.") {
|
||||
TEST_CASE("SCC") {
|
||||
// 1 --> 2 --> 4 --> 1
|
||||
// 2 --> 3 --> 5 --> 7 --> 3
|
||||
// 5 --> 9 --> 6 --> 8 --> 9
|
||||
Graph<std::uint16_t> G;
|
||||
//G.insert(1);
|
||||
//G.insert(1, 2);
|
||||
//G.insert(1, 4);
|
||||
//G.insert(1, 6);
|
||||
//G.insert(2, 4);
|
||||
//G.insert(2, 5);
|
||||
//G.insert(3, 4);
|
||||
//G.insert(3, 6);
|
||||
//G.insert(4, 6);
|
||||
//G.insert(5, 6);
|
||||
G.insert(1, 2);
|
||||
G.insert(2, 3);
|
||||
G.insert(2, 4);
|
||||
G.insert(3, 5);
|
||||
G.insert(4, 1);
|
||||
G.insert(5, 7);
|
||||
G.insert(5, 9);
|
||||
G.insert(6, 8);
|
||||
G.insert(7, 3);
|
||||
G.insert(8, 9);
|
||||
G.insert(9, 6);
|
||||
|
||||
algo::Tarjan<std::uint16_t> tarjan(G);
|
||||
auto tarjanOutput = tarjan.run();
|
||||
|
||||
std::vector<SCC<std::uint16_t>> SCCs;
|
||||
for (const auto& scc : tarjanOutput) {
|
||||
SCCs.push_back(scc);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user