Add single vertex contains method and replace vertices field with adjMatrix' keys

This commit is contained in:
stefiosif
2022-07-20 23:43:15 +03:00
parent 31567f9e57
commit fe3bb68c18
5 changed files with 21 additions and 19 deletions

View File

@@ -66,9 +66,9 @@ void Tarjan<T>::strongConnect(const T& v) {
template<typename T>
std::vector<SCC<T>> Tarjan<T>::execute() {
for (const auto& v : G.vertices) {
if (p[v].index == -1) {
strongConnect(v);
for (auto& v : G.adjMatrix) {
if (p[v.first].index == -1) {
strongConnect(v.first);
}
}