commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1135932 - /commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/Dijkstra.java
Date Wed, 15 Jun 2011 06:44:25 GMT
Author: simonetripodi
Date: Wed Jun 15 06:44:25 2011
New Revision: 1135932

URL: http://svn.apache.org/viewvc?rev=1135932&view=rev
Log:
when/if building the path, the V vertex is already the target, started rebuilding the path
from it

Modified:
    commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/Dijkstra.java

Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/Dijkstra.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/Dijkstra.java?rev=1135932&r1=1135931&r2=1135932&view=diff
==============================================================================
--- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/Dijkstra.java
(original)
+++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/shortestpath/Dijkstra.java
Wed Jun 15 06:44:25 2011
@@ -83,15 +83,14 @@ public final class Dijkstra
             {
                 InMemoryPath<V, WE> path = new InMemoryPath<V, WE>( source, target,
shortestDistances.get( target ) );
 
-                V v = target;
-                while ( !v.equals( source ) )
+                while ( !vertex.equals( source ) )
                 {
-                    WE edge = predecessors.get( v );
+                    WE edge = predecessors.get( vertex );
 
                     path.addEdgeInHead( edge );
-                    path.addVertexInHead( v );
+                    path.addVertexInHead( vertex );
 
-                    v = edge.getHead();
+                    vertex = edge.getHead();
                 }
 
                 return path;



Mime
View raw message