Finish Tarjan algorithm and add tests
This commit is contained in:
@@ -2,33 +2,22 @@
|
||||
|
||||
#include "graph/graph.h"
|
||||
using namespace graph;
|
||||
#include "algorithm/tarjan.h"
|
||||
|
||||
#include <cstdint>
|
||||
#include <iostream>
|
||||
TEST_SUITE("Graph test.") {
|
||||
|
||||
TEST_SUITE("Testing Graph.") {
|
||||
|
||||
TEST_CASE("Insert vertices/edges.") {
|
||||
TEST_CASE("Insertion.") {
|
||||
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(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);
|
||||
|
||||
Vertex<std::uint16_t> v1(1);
|
||||
Vertex<std::uint16_t> v2(3);
|
||||
Vertex<std::uint16_t> v3(5);
|
||||
algorithm::Tarjan<std::uint16_t> tarjan(G);
|
||||
tarjan.findSCC();
|
||||
|
||||
// CHECK_EQ(G.connected(1, 5), true);
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user