commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r1295694 - /commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/visit/DefaultVisitAlgorithmsSelector.java
Date Thu, 01 Mar 2012 17:39:59 GMT
Author: tn
Date: Thu Mar  1 17:39:59 2012
New Revision: 1295694

URL: http://svn.apache.org/viewvc?rev=1295694&view=rev
Log:
fixed unified graph search algorithm in case of non-default visitor implementations

Modified:
    commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/visit/DefaultVisitAlgorithmsSelector.java

Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/visit/DefaultVisitAlgorithmsSelector.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/visit/DefaultVisitAlgorithmsSelector.java?rev=1295694&r1=1295693&r2=1295694&view=diff
==============================================================================
--- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/visit/DefaultVisitAlgorithmsSelector.java
(original)
+++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/visit/DefaultVisitAlgorithmsSelector.java
Thu Mar  1 17:39:59 2012
@@ -138,6 +138,13 @@ final class DefaultVisitAlgorithmsSelect
                 }
             }
 
+            // only mark the current vertex as visited, if the
+            // edge leading to should be expanded
+            if ( !skipVertex )
+            {
+                visitedVertices.add( v );                
+            }
+
             if ( !skipVertex && handler.discoverVertex( v ) )
             {
                 Iterator<V> connected = ( graph instanceof DirectedGraph ) ?
@@ -150,7 +157,6 @@ final class DefaultVisitAlgorithmsSelect
                     if ( !visitedVertices.contains( w ) )
                     {
                         vertexList.addLast( new VertexPair<V>( w, v ) );
-                        visitedVertices.add( w );
                     }
                 }
             }



Mime
View raw message