Selaa lähdekoodia

ENH: DependencyGraph: Set the parent even in the case when a vertex
has already been discovered. In the case of a cycle, this allows for
correct paths for diagnosing the problem. Example:

-> 3
/
1 -> 2 -> 4
\ /
<-

Previously, findPathDFS(...) which uses this->Parent[to] found for 4 to 2:
(4,1,2). Now it finds (4,2) because the new parent for 2 is 4.

Sascha Zelzer 15 vuotta sitten
vanhempi
commit
98b7352a52
1 muutettua tiedostoa jossa 1 lisäystä ja 1 poistoa
  1. 1 1
      Libs/Core/ctkDependencyGraph.cpp

+ 1 - 1
Libs/Core/ctkDependencyGraph.cpp

@@ -138,9 +138,9 @@ void ctkDependencyGraph::ctkInternal::traverseUsingDFS(int v)
 		y = this->edge(v, i);
 		if (this->P->shouldExcludeEdge(this->edge(v, i)) == false)
 		  {
+      this->Parent[y] = v;
 			if (this->Discovered[y] == false)
 			  {
-				this->Parent[y] = v;
 				this->traverseUsingDFS(y);
 			  } 
 			else