1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

Merge branch 'fix/directed_graph_loop_detection_bug' into 'develop'

directed-graph: fix bug in loop detection

See merge request acs/public/villas/VILLASfpga-code!1
This commit is contained in:
Steffen Vogel 2018-02-14 07:22:59 +01:00
commit f621cfc984

View file

@ -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 {