mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
directed-graph: fix bug in loop detection
This commit is contained in:
parent
32be16ef98
commit
6dab50824b
1 changed files with 3 additions and 3 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Reference in a new issue