Make class Graph abstract and make derived classes Digraph and SCC
This commit is contained in:
@@ -1,16 +1,20 @@
|
||||
#include <doctest/doctest.h>
|
||||
|
||||
#include "graph/scc.h"
|
||||
using namespace graph;
|
||||
#include "graph/digraph.h"
|
||||
#include "algorithm/tarjan.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
using namespace graph;
|
||||
|
||||
TEST_SUITE("Graph.") {
|
||||
|
||||
TEST_CASE("SCC") {
|
||||
// 1 --> 2 --> 4 --> 1
|
||||
// 2 --> 3 --> 5 --> 7 --> 3
|
||||
// 5 --> 9 --> 6 --> 8 --> 9
|
||||
Graph<std::uint16_t> G;
|
||||
Digraph<std::uint16_t> G;
|
||||
G.insert(1, 2);
|
||||
G.insert(2, 3);
|
||||
G.insert(2, 4);
|
||||
@@ -24,12 +28,6 @@ TEST_SUITE("Graph.") {
|
||||
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);
|
||||
}
|
||||
|
||||
auto SCCs = tarjan.run();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user