From 6dab50824b82afff03de53adb2e867361cdd0479 Mon Sep 17 00:00:00 2001 From: Daniel Krebs Date: Wed, 7 Feb 2018 10:22:35 +0100 Subject: [PATCH] directed-graph: fix bug in loop detection --- fpga/include/villas/directed_graph.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fpga/include/villas/directed_graph.hpp b/fpga/include/villas/directed_graph.hpp index 8d964dae1..fbac5a556 100644 --- a/fpga/include/villas/directed_graph.hpp +++ b/fpga/include/villas/directed_graph.hpp @@ -204,13 +204,13 @@ public: auto fromVertex = getVertex(fromVertexId); for(auto& edgeId : fromVertex->edges) { - auto edge = getEdge(edgeId); + auto edgeOfFromVertex = getEdge(edgeId); // loop detection bool loop = false; for(auto& edgeIdInPath : path) { auto edgeInPath = getEdge(edgeIdInPath); - if(edgeInPath->from == edgeId) { + if(edgeInPath->from == edgeOfFromVertex->to) { loop = true; break; } @@ -225,7 +225,7 @@ public: path.push_back(edgeId); // recursive, depth-first search - if(getPath(edge->to, toVertexId, path)) { + if(getPath(edgeOfFromVertex->to, toVertexId, path)) { // path found, we're done return true; } else {