You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by tn...@apache.org on 2012/03/01 18:39:59 UTC

svn commit: r1295694 - /commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/visit/DefaultVisitAlgorithmsSelector.java

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 );
                     }
                 }
             }



Re: svn commit: r1295694 - /commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/visit/DefaultVisitAlgorithmsSelector.java

Posted by Simone Tripodi <si...@apache.org>.
YEAH congrats and thank you! :)
-Simo

http://people.apache.org/~simonetripodi/
http://simonetripodi.livejournal.com/
http://twitter.com/simonetripodi
http://www.99soft.org/



On Thu, Mar 1, 2012 at 6:39 PM,  <tn...@apache.org> wrote:
> 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 );
>                     }
>                 }
>             }
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org