Fix includes and add some comments

This commit is contained in:
stefiosif
2022-07-12 14:42:29 +03:00
parent e7ad824116
commit 601f80c8d4
7 changed files with 31 additions and 64 deletions

View File

@@ -1,7 +1,6 @@
#ifndef TARJAN_H_
#define TARJAN_H_
#include "graph/digraph.h"
#include "graph/scc.h"
#include <stack>
@@ -16,10 +15,8 @@ class Tarjan {
public:
Tarjan(Digraph<T> G) : G(G) {}
//
std::vector<SCC<T>> findSCC();
std::vector<SCC<T>> execute();
//
void strongConnect(const T& v);
private:
// Necessary info about vertices when running Tarjan's algorithm
@@ -68,7 +65,7 @@ void Tarjan<T>::strongConnect(const T& v) {
}
template<typename T>
std::vector<SCC<T>> Tarjan<T>::findSCC() {
std::vector<SCC<T>> Tarjan<T>::execute() {
for (const auto& v : G.vertices) {
if (p[v].index == -1) {
strongConnect(v);