commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1204196 - /commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/ssc/CheriyanMehlhornGabowVisitHandler.java
Date Sun, 20 Nov 2011 17:30:16 GMT
Author: simonetripodi
Date: Sun Nov 20 17:30:16 2011
New Revision: 1204196

URL: http://svn.apache.org/viewvc?rev=1204196&view=rev
Log:
managed the preorder counter

Modified:
    commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/ssc/CheriyanMehlhornGabowVisitHandler.java

Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/ssc/CheriyanMehlhornGabowVisitHandler.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/ssc/CheriyanMehlhornGabowVisitHandler.java?rev=1204196&r1=1204195&r2=1204196&view=diff
==============================================================================
--- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/ssc/CheriyanMehlhornGabowVisitHandler.java
(original)
+++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/ssc/CheriyanMehlhornGabowVisitHandler.java
Sun Nov 20 17:30:16 2011
@@ -21,6 +21,8 @@ package org.apache.commons.graph.ssc;
 
 import static org.apache.commons.graph.visit.Visit.depthFirstSearch;
 
+import java.util.HashMap;
+import java.util.Map;
 import java.util.Set;
 import java.util.Stack;
 
@@ -42,12 +44,16 @@ final class CheriyanMehlhornGabowVisitHa
 
     private final DirectedGraph<V, E> graph;
 
+    private final Map<V, Integer> preorder = new HashMap<V, Integer>();
+
     private final Set<V> marked;
 
     private final Stack<V> s = new Stack<V>();
 
     private final Stack<V> p = new Stack<V>();
 
+    private int preorderCounter = 0;
+
     public CheriyanMehlhornGabowVisitHandler( DirectedGraph<V, E> graph, Set<V>
marked )
     {
         this.graph = graph;
@@ -61,6 +67,7 @@ final class CheriyanMehlhornGabowVisitHa
     public void discoverVertex( V vertex )
     {
         marked.add( vertex );
+        preorder.put( vertex, preorderCounter++ );
         s.push( vertex );
         p.push( vertex );
     }



Mime
View raw message