diff --git a/include/CXXGraph/Graph/Algorithm/Dijkstra_impl.hpp b/include/CXXGraph/Graph/Algorithm/Dijkstra_impl.hpp index e0a52a644..b75bc9173 100644 --- a/include/CXXGraph/Graph/Algorithm/Dijkstra_impl.hpp +++ b/include/CXXGraph/Graph/Algorithm/Dijkstra_impl.hpp @@ -140,7 +140,7 @@ const DijkstraResult Graph::dijkstra(const Node& source, result.errorMessage = ""; result.result = dist[*target_node_it]; std::string id = target.getUserId(); - while (parent[id] != "") { + while (!parent[id].empty()) { result.path.push_back(id); id = parent[id]; } @@ -288,7 +288,7 @@ const DijkstraResult Graph::dijkstra_deterministic( result.errorMessage = ""; result.result = dist[*target_node_it]; std::string id = target.getUserId(); - while (parent[id] != "") { + while (!parent[id].empty()) { result.path.push_back(id); id = parent[id]; } @@ -444,7 +444,7 @@ const DijkstraResult Graph::dijkstra_deterministic2( result.errorMessage = ""; result.result = dist[*target_node_it]; std::string id = target.getUserId(); - while (parent[id] != "") { + while (!parent[id].empty()) { result.path.push_back(id); id = parent[id]; } @@ -591,7 +591,7 @@ const DijkstraResult Graph::criticalpath_deterministic( result.errorMessage = ""; result.result = dist[*target_node_it]; std::string id = target.getUserId(); - while (parent[id] != "") { + while (!parent[id].empty()) { result.path.push_back(id); id = parent[id]; } diff --git a/include/CXXGraph/Graph/Algorithm/EulerianPath_impl.hpp b/include/CXXGraph/Graph/Algorithm/EulerianPath_impl.hpp index 312d6c443..4cf67a5c0 100644 --- a/include/CXXGraph/Graph/Algorithm/EulerianPath_impl.hpp +++ b/include/CXXGraph/Graph/Algorithm/EulerianPath_impl.hpp @@ -47,7 +47,7 @@ std::shared_ptr>> Graph::eulerianPath() const { auto currentNode = *(firstNodeIt); currentPath.push_back(currentNode); - while (currentPath.size() > 0) { + while (!currentPath.empty()) { auto &edges = cachedAdjListOut->at(currentNode); // we keep removing the edges that // have been traversed from the adjacency list diff --git a/include/CXXGraph/Graph/Algorithm/Kosaraju_impl.hpp b/include/CXXGraph/Graph/Algorithm/Kosaraju_impl.hpp index ffbf421a0..7ee2b7f2c 100644 --- a/include/CXXGraph/Graph/Algorithm/Kosaraju_impl.hpp +++ b/include/CXXGraph/Graph/Algorithm/Kosaraju_impl.hpp @@ -109,7 +109,7 @@ SCCResult Graph::kosaraju() const { }; int sccLabel = 0; - while (st.size() != 0) { + while (!st.empty()) { auto rem = st.top(); st.pop(); if (visited[rem->getId()] == false) {