commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1486948 [3/5] - in /commons/sandbox/graph/branches/modularization: ./ api/ api/src/ api/src/main/ api/src/main/java/ api/src/main/java/org/ api/src/main/java/org/apache/ api/src/main/java/org/apache/commons/ api/src/main/java/org/apache/co...
Date Tue, 28 May 2013 15:00:33 GMT
Modified: commons/sandbox/graph/branches/modularization/coloring/src/test/java/org/apache/commons/graph/coloring/GraphColoringTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/branches/modularization/coloring/src/test/java/org/apache/commons/graph/coloring/GraphColoringTestCase.java?rev=1486948&r1=1486620&r2=1486948&view=diff
==============================================================================
--- commons/sandbox/graph/branches/modularization/coloring/src/test/java/org/apache/commons/graph/coloring/GraphColoringTestCase.java (original)
+++ commons/sandbox/graph/branches/modularization/coloring/src/test/java/org/apache/commons/graph/coloring/GraphColoringTestCase.java Tue May 28 15:00:27 2013
@@ -19,12 +19,8 @@ package org.apache.commons.graph.colorin
  * under the License.
  */
 
-import static org.apache.commons.graph.CommonsGraph.coloring;
-import static org.apache.commons.graph.CommonsGraph.newUndirectedMutableGraph;
-import static org.apache.commons.graph.utils.GraphUtils.buildBipartedGraph;
-import static org.apache.commons.graph.utils.GraphUtils.buildCompleteGraph;
-import static org.apache.commons.graph.utils.GraphUtils.buildCrownGraph;
-import static org.apache.commons.graph.utils.GraphUtils.buildSudokuGraph;
+import static org.apache.commons.graph.Graphs.populate;
+import static org.apache.commons.graph.coloring.ColoringSolver.coloring;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 
@@ -32,10 +28,10 @@ import java.util.Set;
 
 import org.apache.commons.graph.UndirectedGraph;
 import org.apache.commons.graph.builder.AbstractGraphConnection;
-import org.apache.commons.graph.model.BaseLabeledEdge;
-import org.apache.commons.graph.model.BaseLabeledVertex;
-import org.apache.commons.graph.model.BaseLabeledWeightedEdge;
 import org.apache.commons.graph.model.UndirectedMutableGraph;
+import org.apache.commons.graph.model.labeled.BaseLabeledEdge;
+import org.apache.commons.graph.model.labeled.BaseLabeledVertex;
+import org.apache.commons.graph.model.labeled.BaseLabeledWeightedEdge;
 import org.junit.Test;
 
 /**
@@ -78,22 +74,23 @@ public class GraphColoringTestCase exten
         final BaseLabeledVertex two = new BaseLabeledVertex( "2" );
 
         UndirectedMutableGraph<BaseLabeledVertex, BaseLabeledEdge> g =
-            newUndirectedMutableGraph( new AbstractGraphConnection<BaseLabeledVertex, BaseLabeledEdge>()
+        populate( new UndirectedMutableGraph<BaseLabeledVertex, BaseLabeledEdge>() )
+        .withConnections( new AbstractGraphConnection<BaseLabeledVertex, BaseLabeledEdge>()
+        {
+
+            @Override
+            public void connect()
             {
+                BaseLabeledVertex one = addVertex( new BaseLabeledVertex( "1" ) );
+                addVertex( two );
+                BaseLabeledVertex three = addVertex( new BaseLabeledVertex( "3" ) );
 
-                @Override
-                public void connect()
-                {
-                    BaseLabeledVertex one = addVertex( new BaseLabeledVertex( "1" ) );
-                    addVertex( two );
-                    BaseLabeledVertex three = addVertex( new BaseLabeledVertex( "3" ) );
-
-                    addEdge( new BaseLabeledEdge( "1 -> 2" ) ).from( one ).to( two );
-                    addEdge( new BaseLabeledEdge( "2 -> 3" ) ).from( two ).to( three );
-                    addEdge( new BaseLabeledEdge( "3 -> 1" ) ).from( three ).to( one );
-                }
+                addEdge( new BaseLabeledEdge( "1 -> 2" ) ).from( one ).to( two );
+                addEdge( new BaseLabeledEdge( "2 -> 3" ) ).from( two ).to( three );
+                addEdge( new BaseLabeledEdge( "3 -> 1" ) ).from( three ).to( one );
+            }
 
-            } );
+        } );
         coloring( g ).withColors( createColorsList( 1 ) ).applyingGreedyAlgorithm();
     }
 
@@ -102,7 +99,8 @@ public class GraphColoringTestCase exten
         throws Exception
     {
         UndirectedMutableGraph<BaseLabeledVertex, BaseLabeledEdge> g =
-        newUndirectedMutableGraph( new AbstractGraphConnection<BaseLabeledVertex, BaseLabeledEdge>()
+        populate( new UndirectedMutableGraph<BaseLabeledVertex, BaseLabeledEdge>() )
+        .withConnections( new AbstractGraphConnection<BaseLabeledVertex, BaseLabeledEdge>()
         {
 
             @Override

Propchange: commons/sandbox/graph/branches/modularization/connectivity/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue May 28 15:00:27 2013
@@ -0,0 +1,2 @@
+.settings
+target

Added: commons/sandbox/graph/branches/modularization/connectivity/pom.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/branches/modularization/connectivity/pom.xml?rev=1486948&view=auto
==============================================================================
--- commons/sandbox/graph/branches/modularization/connectivity/pom.xml (added)
+++ commons/sandbox/graph/branches/modularization/connectivity/pom.xml Tue May 28 15:00:27 2013
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.commons</groupId>
+    <artifactId>commons-graph</artifactId>
+    <version>0.1-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>commons-graph-connectivity</artifactId>
+
+  <name>Apache Commons Graph - Connectivity</name>
+  <description>Graph connectivity problem solver implementation.</description>
+
+  <dependencies>
+    <dependency>
+      <groupId>${project.parent.groupId}</groupId>
+      <artifactId>commons-graph-api</artifactId>
+      <version>${project.parent.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>${project.parent.groupId}</groupId>
+      <artifactId>commons-graph-visit</artifactId>
+      <version>${project.parent.version}</version>
+    </dependency>
+
+    <!-- test dependencies -->
+    <dependency>
+      <groupId>${project.parent.groupId}</groupId>
+      <artifactId>commons-graph-model</artifactId>
+      <version>${project.parent.version}</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <resources>
+      <resource>
+        <directory>${basedir}/../</directory>
+        <targetPath>META-INF</targetPath>
+        <includes>
+          <include>NOTICE.txt</include>
+          <include>LICENSE.txt</include>
+        </includes>
+      </resource>
+    </resources>
+  </build>
+
+</project>

Propchange: commons/sandbox/graph/branches/modularization/connectivity/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/graph/branches/modularization/connectivity/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: commons/sandbox/graph/branches/modularization/connectivity/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: commons/sandbox/graph/branches/modularization/connectivity/src/main/java/org/apache/commons/graph/connectivity/ConnectivitySolver.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/branches/modularization/connectivity/src/main/java/org/apache/commons/graph/connectivity/ConnectivitySolver.java?rev=1486948&view=auto
==============================================================================
--- commons/sandbox/graph/branches/modularization/connectivity/src/main/java/org/apache/commons/graph/connectivity/ConnectivitySolver.java (added)
+++ commons/sandbox/graph/branches/modularization/connectivity/src/main/java/org/apache/commons/graph/connectivity/ConnectivitySolver.java Tue May 28 15:00:27 2013
@@ -0,0 +1,49 @@
+package org.apache.commons.graph.connectivity;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import static org.apache.commons.graph.utils.Assertions.checkNotNull;
+
+import org.apache.commons.graph.Graph;
+
+public final class ConnectivitySolver
+{
+
+    /**
+     * Calculates the input graph Connected Component.
+     *
+     * @param <V> the Graph vertices type.
+     * @param <E> the Graph edges type.
+     * @param <G> the directed graph type
+     * @param graph the Graph which connected component has to be verified.
+     * @return the Connectivity algorithm builder
+     */
+    public static <V, E, G extends Graph<V, E>> ConnectivityBuilder<V, E> findConnectedComponent( G graph )
+    {
+        graph = checkNotNull( graph, "Connected Component cannot be calculated from a null graph" );
+        return new DefaultConnectivityBuilder<V, E>( graph );
+    }
+
+    private ConnectivitySolver()
+    {
+        // do nothing
+    }
+
+}

Propchange: commons/sandbox/graph/branches/modularization/connectivity/src/main/java/org/apache/commons/graph/connectivity/ConnectivitySolver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/graph/branches/modularization/connectivity/src/main/java/org/apache/commons/graph/connectivity/ConnectivitySolver.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/graph/branches/modularization/connectivity/src/main/java/org/apache/commons/graph/connectivity/ConnectivitySolver.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: commons/sandbox/graph/branches/modularization/connectivity/src/main/java/org/apache/commons/graph/connectivity/DefaultConnectivityAlgorithmsSelector.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/branches/modularization/connectivity/src/main/java/org/apache/commons/graph/connectivity/DefaultConnectivityAlgorithmsSelector.java?rev=1486948&r1=1486620&r2=1486948&view=diff
==============================================================================
--- commons/sandbox/graph/branches/modularization/connectivity/src/main/java/org/apache/commons/graph/connectivity/DefaultConnectivityAlgorithmsSelector.java (original)
+++ commons/sandbox/graph/branches/modularization/connectivity/src/main/java/org/apache/commons/graph/connectivity/DefaultConnectivityAlgorithmsSelector.java Tue May 28 15:00:27 2013
@@ -19,7 +19,7 @@ package org.apache.commons.graph.connect
  * under the License.
  */
 
-import static org.apache.commons.graph.CommonsGraph.visit;
+import static org.apache.commons.graph.visit.GraphVisitor.visit;
 import static org.apache.commons.graph.utils.Assertions.checkState;
 
 import java.util.ArrayList;
@@ -31,7 +31,7 @@ import org.apache.commons.graph.Graph;
 
 /**
  * TODO Fill me!!
- * 
+ *
  * @param <V> the Graph vertices type
  * @param <E> the Graph edges type
  */
@@ -45,7 +45,7 @@ final class DefaultConnectivityAlgorithm
 
     /**
      * Create a new instance of {@link DefaultConnectivityAlgorithmsSelector} calculated for a set of included vertices
-     * 
+     *
      * @param graph the graph
      * @param includedVertices included vertices
      */

Modified: commons/sandbox/graph/branches/modularization/connectivity/src/main/java/org/apache/commons/graph/connectivity/DefaultConnectivityBuilder.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/branches/modularization/connectivity/src/main/java/org/apache/commons/graph/connectivity/DefaultConnectivityBuilder.java?rev=1486948&r1=1486620&r2=1486948&view=diff
==============================================================================
--- commons/sandbox/graph/branches/modularization/connectivity/src/main/java/org/apache/commons/graph/connectivity/DefaultConnectivityBuilder.java (original)
+++ commons/sandbox/graph/branches/modularization/connectivity/src/main/java/org/apache/commons/graph/connectivity/DefaultConnectivityBuilder.java Tue May 28 15:00:27 2013
@@ -26,11 +26,11 @@ import org.apache.commons.graph.Graph;
 
 /**
  * TODO Fill me!!
- * 
+ *
  * @param <V> the Graph vertices type
  * @param <E> the Graph edges type
  */
-public class DefaultConnectivityBuilder<V, E>
+final class DefaultConnectivityBuilder<V, E>
     implements ConnectivityBuilder<V, E>
 {
 

Modified: commons/sandbox/graph/branches/modularization/connectivity/src/test/java/org/apache/commons/graph/connectivity/FindConnectedComponetTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/branches/modularization/connectivity/src/test/java/org/apache/commons/graph/connectivity/FindConnectedComponetTestCase.java?rev=1486948&r1=1486620&r2=1486948&view=diff
==============================================================================
--- commons/sandbox/graph/branches/modularization/connectivity/src/test/java/org/apache/commons/graph/connectivity/FindConnectedComponetTestCase.java (original)
+++ commons/sandbox/graph/branches/modularization/connectivity/src/test/java/org/apache/commons/graph/connectivity/FindConnectedComponetTestCase.java Tue May 28 15:00:27 2013
@@ -19,8 +19,8 @@ package org.apache.commons.graph.connect
  * under the License.
  */
 
-import static org.apache.commons.graph.CommonsGraph.findConnectedComponent;
-import static org.apache.commons.graph.CommonsGraph.newUndirectedMutableGraph;
+import static org.apache.commons.graph.Graphs.populate;
+import static org.apache.commons.graph.connectivity.ConnectivitySolver.findConnectedComponent;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
@@ -30,10 +30,11 @@ import java.util.List;
 
 import org.apache.commons.graph.Graph;
 import org.apache.commons.graph.builder.AbstractGraphConnection;
-import org.apache.commons.graph.model.BaseLabeledEdge;
-import org.apache.commons.graph.model.BaseLabeledVertex;
-import org.apache.commons.graph.model.BaseLabeledWeightedEdge;
+import org.apache.commons.graph.builder.GraphConnection;
 import org.apache.commons.graph.model.UndirectedMutableGraph;
+import org.apache.commons.graph.model.labeled.BaseLabeledEdge;
+import org.apache.commons.graph.model.labeled.BaseLabeledVertex;
+import org.apache.commons.graph.model.labeled.BaseLabeledWeightedEdge;
 import org.junit.Test;
 
 /**
@@ -41,7 +42,7 @@ import org.junit.Test;
 public final class FindConnectedComponetTestCase
 {
 
-    @Test(expected=NullPointerException.class)
+    @Test( expected = NullPointerException.class )
     public void verifyNullGraph()
     {
         findConnectedComponent( (Graph<BaseLabeledVertex, BaseLabeledWeightedEdge<Double>>) null ).includingAllVertices().applyingMinimumSpanningTreeAlgorithm();
@@ -246,4 +247,9 @@ public final class FindConnectedComponet
         assertEquals( 2, coll.size() );
     }
 
+    private UndirectedMutableGraph<BaseLabeledVertex, BaseLabeledEdge> newUndirectedMutableGraph( GraphConnection<BaseLabeledVertex, BaseLabeledEdge> graphConnection )
+    {
+        return populate( new UndirectedMutableGraph<BaseLabeledVertex, BaseLabeledEdge>() ).withConnections( graphConnection );
+    }
+
 }

Propchange: commons/sandbox/graph/branches/modularization/elo/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue May 28 15:00:27 2013
@@ -0,0 +1,2 @@
+.settings
+target

Added: commons/sandbox/graph/branches/modularization/elo/pom.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/branches/modularization/elo/pom.xml?rev=1486948&view=auto
==============================================================================
--- commons/sandbox/graph/branches/modularization/elo/pom.xml (added)
+++ commons/sandbox/graph/branches/modularization/elo/pom.xml Tue May 28 15:00:27 2013
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.commons</groupId>
+    <artifactId>commons-graph</artifactId>
+    <version>0.1-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>commons-graph-elo</artifactId>
+
+  <name>Apache Commons Graph - ELO</name>
+  <description>Graph ELO rating implementation.</description>
+
+  <dependencies>
+    <dependency>
+      <groupId>${project.parent.groupId}</groupId>
+      <artifactId>commons-graph-api</artifactId>
+      <version>${project.parent.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>${project.parent.groupId}</groupId>
+      <artifactId>commons-graph-model</artifactId>
+      <version>${project.parent.version}</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <resources>
+      <resource>
+        <directory>${basedir}/../</directory>
+        <targetPath>META-INF</targetPath>
+        <includes>
+          <include>NOTICE.txt</include>
+          <include>LICENSE.txt</include>
+        </includes>
+      </resource>
+    </resources>
+  </build>
+
+</project>

Propchange: commons/sandbox/graph/branches/modularization/elo/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/graph/branches/modularization/elo/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: commons/sandbox/graph/branches/modularization/elo/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: commons/sandbox/graph/branches/modularization/elo/src/main/java/org/apache/commons/graph/elo/EloSolver.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/branches/modularization/elo/src/main/java/org/apache/commons/graph/elo/EloSolver.java?rev=1486948&view=auto
==============================================================================
--- commons/sandbox/graph/branches/modularization/elo/src/main/java/org/apache/commons/graph/elo/EloSolver.java (added)
+++ commons/sandbox/graph/branches/modularization/elo/src/main/java/org/apache/commons/graph/elo/EloSolver.java Tue May 28 15:00:27 2013
@@ -0,0 +1,49 @@
+package org.apache.commons.graph.elo;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import static org.apache.commons.graph.utils.Assertions.checkNotNull;
+
+import org.apache.commons.graph.DirectedGraph;
+
+public final class EloSolver
+{
+
+    /**
+     * Ranks the players (vertices) that took part in a tournament (graph) depending on the game results (edges),
+     * applying the <a href="http://en.wikipedia.org/wiki/Elo_rating_system.">Elo Rating System</a>.
+     *
+     * @param <P> the players involved in the tournament
+     * @param <TG> the Tournament Graph type
+     * @param tournamentGraph the graph representing the tournament
+     * @return the builder for the functor which returns/update the players ranking
+     */
+    public static <P, TG extends DirectedGraph<P, GameResult>> RankingSelector<P> eloRate( TG tournamentGraph )
+    {
+        tournamentGraph = checkNotNull( tournamentGraph, "ELO ranking can not be applied on null graph!" );
+        return new DefaultRankingSelector<P>( tournamentGraph );
+    }
+
+    private EloSolver()
+    {
+        // do nothing
+    }
+
+}

Propchange: commons/sandbox/graph/branches/modularization/elo/src/main/java/org/apache/commons/graph/elo/EloSolver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/graph/branches/modularization/elo/src/main/java/org/apache/commons/graph/elo/EloSolver.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/graph/branches/modularization/elo/src/main/java/org/apache/commons/graph/elo/EloSolver.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: commons/sandbox/graph/branches/modularization/elo/src/test/java/org/apache/commons/graph/elo/EloTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/branches/modularization/elo/src/test/java/org/apache/commons/graph/elo/EloTestCase.java?rev=1486948&r1=1486620&r2=1486948&view=diff
==============================================================================
--- commons/sandbox/graph/branches/modularization/elo/src/test/java/org/apache/commons/graph/elo/EloTestCase.java (original)
+++ commons/sandbox/graph/branches/modularization/elo/src/test/java/org/apache/commons/graph/elo/EloTestCase.java Tue May 28 15:00:27 2013
@@ -21,11 +21,12 @@ package org.apache.commons.graph.elo;
 
 import static org.apache.commons.graph.elo.GameResult.WIN;
 
-import static org.apache.commons.graph.CommonsGraph.eloRate;
-import static org.apache.commons.graph.CommonsGraph.newDirectedMutableGraph;
+import static org.apache.commons.graph.elo.EloSolver.eloRate;
+import static org.apache.commons.graph.Graphs.populate;
 
 import org.apache.commons.graph.DirectedGraph;
 import org.apache.commons.graph.builder.AbstractGraphConnection;
+import org.apache.commons.graph.model.DirectedMutableGraph;
 import org.junit.Test;
 
 /**
@@ -38,7 +39,8 @@ public final class EloTestCase
     public void performElo()
     {
         DirectedGraph<String, GameResult> tournament =
-        newDirectedMutableGraph( new AbstractGraphConnection<String, GameResult>()
+        populate( new DirectedMutableGraph<String, GameResult>() )
+        .withConnections( new AbstractGraphConnection<String, GameResult>()
         {
 
             @Override
@@ -85,6 +87,7 @@ public final class EloTestCase
 
         eloRate( tournament ).wherePlayersAreRankedIn( playersRank ).withKFactor( 80 );
 
+        // TODO find a way to asser the rate worked
         System.out.println( playersRank );
     }
 

Propchange: commons/sandbox/graph/branches/modularization/export/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue May 28 15:00:27 2013
@@ -0,0 +1,2 @@
+.settings
+target

Added: commons/sandbox/graph/branches/modularization/export/pom.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/branches/modularization/export/pom.xml?rev=1486948&view=auto
==============================================================================
--- commons/sandbox/graph/branches/modularization/export/pom.xml (added)
+++ commons/sandbox/graph/branches/modularization/export/pom.xml Tue May 28 15:00:27 2013
@@ -0,0 +1,61 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.commons</groupId>
+    <artifactId>commons-graph</artifactId>
+    <version>0.1-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>commons-graph-export</artifactId>
+
+  <name>Apache Commons Graph - Export</name>
+  <description>Graph exporters to different formats implementation.</description>
+
+  <dependencies>
+    <dependency>
+      <groupId>${project.parent.groupId}</groupId>
+      <artifactId>commons-graph-api</artifactId>
+      <version>${project.parent.version}</version>
+    </dependency>
+
+    <!-- test dependencies -->
+    <dependency>
+      <groupId>${project.parent.groupId}</groupId>
+      <artifactId>commons-graph-model</artifactId>
+      <version>${project.parent.version}</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <resources>
+      <resource>
+        <directory>${basedir}/../</directory>
+        <targetPath>META-INF</targetPath>
+        <includes>
+          <include>NOTICE.txt</include>
+          <include>LICENSE.txt</include>
+        </includes>
+      </resource>
+    </resources>
+  </build>
+
+</project>

Propchange: commons/sandbox/graph/branches/modularization/export/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/graph/branches/modularization/export/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: commons/sandbox/graph/branches/modularization/export/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: commons/sandbox/graph/branches/modularization/export/src/main/java/org/apache/commons/graph/export/DefaultExportSelector.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/branches/modularization/export/src/main/java/org/apache/commons/graph/export/DefaultExportSelector.java?rev=1486948&r1=1486620&r2=1486948&view=diff
==============================================================================
--- commons/sandbox/graph/branches/modularization/export/src/main/java/org/apache/commons/graph/export/DefaultExportSelector.java (original)
+++ commons/sandbox/graph/branches/modularization/export/src/main/java/org/apache/commons/graph/export/DefaultExportSelector.java Tue May 28 15:00:27 2013
@@ -25,11 +25,11 @@ import org.apache.commons.graph.Graph;
 
 /**
  * {@link NamedExportSelector} implementation
- * 
+ *
  * @param <V> the Graph vertices type.
  * @param <E> the Graph edges type.
  */
-public final class DefaultExportSelector<V, E>
+final class DefaultExportSelector<V, E>
     implements NamedExportSelector<V, E>
 {
 

Added: commons/sandbox/graph/branches/modularization/export/src/main/java/org/apache/commons/graph/export/GraphExporter.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/branches/modularization/export/src/main/java/org/apache/commons/graph/export/GraphExporter.java?rev=1486948&view=auto
==============================================================================
--- commons/sandbox/graph/branches/modularization/export/src/main/java/org/apache/commons/graph/export/GraphExporter.java (added)
+++ commons/sandbox/graph/branches/modularization/export/src/main/java/org/apache/commons/graph/export/GraphExporter.java Tue May 28 15:00:27 2013
@@ -0,0 +1,49 @@
+package org.apache.commons.graph.export;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import static org.apache.commons.graph.utils.Assertions.checkNotNull;
+
+import org.apache.commons.graph.Graph;
+
+public final class GraphExporter
+{
+
+    /**
+     * Export the graph in DOT or GraphML format.
+     *
+     * @param <V> the Graph vertices type
+     * @param <E> the Graph edges type
+     * @param <G> the Graph type
+     * @param graph the input graph
+     * @return an instance of {@link NamedExportSelector}
+     */
+    public static <V, E, G extends Graph<V, E>> NamedExportSelector<V, E> export( G graph )
+    {
+        graph = checkNotNull( graph, "Null graph can not be exported" );
+        return new DefaultExportSelector<V, E>( graph );
+    }
+
+    private GraphExporter()
+    {
+        // do nothing
+    }
+
+}

Propchange: commons/sandbox/graph/branches/modularization/export/src/main/java/org/apache/commons/graph/export/GraphExporter.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/graph/branches/modularization/export/src/main/java/org/apache/commons/graph/export/GraphExporter.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/graph/branches/modularization/export/src/main/java/org/apache/commons/graph/export/GraphExporter.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: commons/sandbox/graph/branches/modularization/export/src/test/java/org/apache/commons/graph/export/EdgeLabelMapper.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/branches/modularization/export/src/test/java/org/apache/commons/graph/export/EdgeLabelMapper.java?rev=1486948&r1=1486620&r2=1486948&view=diff
==============================================================================
--- commons/sandbox/graph/branches/modularization/export/src/test/java/org/apache/commons/graph/export/EdgeLabelMapper.java (original)
+++ commons/sandbox/graph/branches/modularization/export/src/test/java/org/apache/commons/graph/export/EdgeLabelMapper.java Tue May 28 15:00:27 2013
@@ -20,7 +20,7 @@ package org.apache.commons.graph.export;
  */
 
 import org.apache.commons.graph.Mapper;
-import org.apache.commons.graph.model.BaseLabeledWeightedEdge;
+import org.apache.commons.graph.model.labeled.BaseLabeledWeightedEdge;
 
 public final class EdgeLabelMapper
     implements Mapper<BaseLabeledWeightedEdge<Double>, String>

Modified: commons/sandbox/graph/branches/modularization/export/src/test/java/org/apache/commons/graph/export/EdgeWeightMapper.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/branches/modularization/export/src/test/java/org/apache/commons/graph/export/EdgeWeightMapper.java?rev=1486948&r1=1486620&r2=1486948&view=diff
==============================================================================
--- commons/sandbox/graph/branches/modularization/export/src/test/java/org/apache/commons/graph/export/EdgeWeightMapper.java (original)
+++ commons/sandbox/graph/branches/modularization/export/src/test/java/org/apache/commons/graph/export/EdgeWeightMapper.java Tue May 28 15:00:27 2013
@@ -20,7 +20,7 @@ package org.apache.commons.graph.export;
  */
 
 import org.apache.commons.graph.Mapper;
-import org.apache.commons.graph.model.BaseLabeledWeightedEdge;
+import org.apache.commons.graph.model.labeled.BaseLabeledWeightedEdge;
 
 public final class EdgeWeightMapper
     implements Mapper<BaseLabeledWeightedEdge<Double>, Double>

Modified: commons/sandbox/graph/branches/modularization/export/src/test/java/org/apache/commons/graph/export/ExportTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/branches/modularization/export/src/test/java/org/apache/commons/graph/export/ExportTestCase.java?rev=1486948&r1=1486620&r2=1486948&view=diff
==============================================================================
--- commons/sandbox/graph/branches/modularization/export/src/test/java/org/apache/commons/graph/export/ExportTestCase.java (original)
+++ commons/sandbox/graph/branches/modularization/export/src/test/java/org/apache/commons/graph/export/ExportTestCase.java Tue May 28 15:00:27 2013
@@ -19,18 +19,21 @@ package org.apache.commons.graph.export;
  * under the License.
  */
 
-import static org.apache.commons.graph.CommonsGraph.export;
-import static org.apache.commons.graph.CommonsGraph.newUndirectedMutableGraph;
+import static org.apache.commons.graph.Graphs.populate;
+import static org.apache.commons.graph.export.GraphExporter.export;
 
 import org.apache.commons.graph.builder.AbstractGraphConnection;
-import org.apache.commons.graph.model.BaseLabeledVertex;
-import org.apache.commons.graph.model.BaseLabeledWeightedEdge;
 import org.apache.commons.graph.model.UndirectedMutableGraph;
+import org.apache.commons.graph.model.labeled.BaseLabeledVertex;
+import org.apache.commons.graph.model.labeled.BaseLabeledWeightedEdge;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Ignore;
 import org.junit.Test;
 
+/**
+ * TODO find a way to assert exported graphs
+ */
 public class ExportTestCase {
 
     private UndirectedMutableGraph<BaseLabeledVertex, BaseLabeledWeightedEdge<Double>> actual;
@@ -39,7 +42,8 @@ public class ExportTestCase {
     public void setUp()
     {
         actual =
-        newUndirectedMutableGraph( new AbstractGraphConnection<BaseLabeledVertex, BaseLabeledWeightedEdge<Double>>()
+        populate( new UndirectedMutableGraph<BaseLabeledVertex, BaseLabeledWeightedEdge<Double>>() )
+        .withConnections( new AbstractGraphConnection<BaseLabeledVertex, BaseLabeledWeightedEdge<Double>>()
         {
 
             public void connect()

Modified: commons/sandbox/graph/branches/modularization/export/src/test/java/org/apache/commons/graph/export/VertexLabelMapper.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/branches/modularization/export/src/test/java/org/apache/commons/graph/export/VertexLabelMapper.java?rev=1486948&r1=1486620&r2=1486948&view=diff
==============================================================================
--- commons/sandbox/graph/branches/modularization/export/src/test/java/org/apache/commons/graph/export/VertexLabelMapper.java (original)
+++ commons/sandbox/graph/branches/modularization/export/src/test/java/org/apache/commons/graph/export/VertexLabelMapper.java Tue May 28 15:00:27 2013
@@ -20,7 +20,7 @@ package org.apache.commons.graph.export;
  */
 
 import org.apache.commons.graph.Mapper;
-import org.apache.commons.graph.model.BaseLabeledVertex;
+import org.apache.commons.graph.model.labeled.BaseLabeledVertex;
 
 public final class VertexLabelMapper
     implements Mapper<BaseLabeledVertex, String>

Propchange: commons/sandbox/graph/branches/modularization/flow/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue May 28 15:00:27 2013
@@ -0,0 +1,2 @@
+.settings
+target

Added: commons/sandbox/graph/branches/modularization/flow/pom.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/branches/modularization/flow/pom.xml?rev=1486948&view=auto
==============================================================================
--- commons/sandbox/graph/branches/modularization/flow/pom.xml (added)
+++ commons/sandbox/graph/branches/modularization/flow/pom.xml Tue May 28 15:00:27 2013
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.commons</groupId>
+    <artifactId>commons-graph</artifactId>
+    <version>0.1-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>commons-graph-flow</artifactId>
+
+  <name>Apache Commons Graph - Flow</name>
+  <description>Graph flow problem solver implementation.</description>
+
+  <dependencies>
+    <dependency>
+      <groupId>${project.parent.groupId}</groupId>
+      <artifactId>commons-graph-api</artifactId>
+      <version>${project.parent.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>${project.parent.groupId}</groupId>
+      <artifactId>commons-graph-visit</artifactId>
+      <version>${project.parent.version}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>${project.parent.groupId}</groupId>
+      <artifactId>commons-graph-model</artifactId>
+      <version>${project.parent.version}</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <resources>
+      <resource>
+        <directory>${basedir}/../</directory>
+        <targetPath>META-INF</targetPath>
+        <includes>
+          <include>NOTICE.txt</include>
+          <include>LICENSE.txt</include>
+        </includes>
+      </resource>
+    </resources>
+  </build>
+
+</project>

Propchange: commons/sandbox/graph/branches/modularization/flow/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/graph/branches/modularization/flow/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: commons/sandbox/graph/branches/modularization/flow/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: commons/sandbox/graph/branches/modularization/flow/src/main/java/org/apache/commons/graph/flow/DefaultFlowWeightedEdgesBuilder.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/branches/modularization/flow/src/main/java/org/apache/commons/graph/flow/DefaultFlowWeightedEdgesBuilder.java?rev=1486948&r1=1486620&r2=1486948&view=diff
==============================================================================
--- commons/sandbox/graph/branches/modularization/flow/src/main/java/org/apache/commons/graph/flow/DefaultFlowWeightedEdgesBuilder.java (original)
+++ commons/sandbox/graph/branches/modularization/flow/src/main/java/org/apache/commons/graph/flow/DefaultFlowWeightedEdgesBuilder.java Tue May 28 15:00:27 2013
@@ -26,11 +26,11 @@ import org.apache.commons.graph.Mapper;
 
 /**
  * {@link FlowWeightedEdgesBuilder} implementation
- * 
+ *
  * @param <V> the Graph vertices type
  * @param <WE> the Graph edges type
  */
-public final class DefaultFlowWeightedEdgesBuilder<V, WE>
+final class DefaultFlowWeightedEdgesBuilder<V, WE>
     implements FlowWeightedEdgesBuilder<V, WE>
 {
 

Modified: commons/sandbox/graph/branches/modularization/flow/src/main/java/org/apache/commons/graph/flow/DefaultMaxFlowAlgorithmSelector.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/branches/modularization/flow/src/main/java/org/apache/commons/graph/flow/DefaultMaxFlowAlgorithmSelector.java?rev=1486948&r1=1486620&r2=1486948&view=diff
==============================================================================
--- commons/sandbox/graph/branches/modularization/flow/src/main/java/org/apache/commons/graph/flow/DefaultMaxFlowAlgorithmSelector.java (original)
+++ commons/sandbox/graph/branches/modularization/flow/src/main/java/org/apache/commons/graph/flow/DefaultMaxFlowAlgorithmSelector.java Tue May 28 15:00:27 2013
@@ -19,15 +19,16 @@ package org.apache.commons.graph.flow;
  * under the License.
  */
 
-import static org.apache.commons.graph.CommonsGraph.newDirectedMutableGraph;
-import static org.apache.commons.graph.CommonsGraph.visit;
+import static org.apache.commons.graph.Graphs.populate;
 import static org.apache.commons.graph.utils.Assertions.checkNotNull;
+import static org.apache.commons.graph.visit.GraphVisitor.visit;
 
 import org.apache.commons.graph.DirectedGraph;
 import org.apache.commons.graph.Mapper;
 import org.apache.commons.graph.VertexPair;
 import org.apache.commons.graph.builder.AbstractGraphConnection;
-import org.apache.commons.graph.weight.OrderedMonoid;
+import org.apache.commons.graph.math.monoid.OrderedMonoid;
+import org.apache.commons.graph.model.DirectedMutableGraph;
 
 /**
  * {@link MaxFlowAlgorithmSelector} implementation.
@@ -115,7 +116,8 @@ final class DefaultMaxFlowAlgorithmSelec
     private <WO extends OrderedMonoid<W>> DirectedGraph<V, EdgeWrapper<WE>> newFlowNetwok( final DirectedGraph<V, WE> graph,
                                                                                            final WO weightOperations )
     {
-        return newDirectedMutableGraph( new AbstractGraphConnection<V, EdgeWrapper<WE>>()
+        return populate( new DirectedMutableGraph<V, EdgeWrapper<WE>>() )
+               .withConnections( new AbstractGraphConnection<V, EdgeWrapper<WE>>()
         {
             @Override
             public void connect()
@@ -125,6 +127,7 @@ final class DefaultMaxFlowAlgorithmSelec
                 {
                     addVertex( vertex );
                 }
+
                 // edges
                 for ( WE edge : graph.getEdges() )
                 {

Modified: commons/sandbox/graph/branches/modularization/flow/src/main/java/org/apache/commons/graph/flow/FlowNetworkHandler.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/branches/modularization/flow/src/main/java/org/apache/commons/graph/flow/FlowNetworkHandler.java?rev=1486948&r1=1486620&r2=1486948&view=diff
==============================================================================
--- commons/sandbox/graph/branches/modularization/flow/src/main/java/org/apache/commons/graph/flow/FlowNetworkHandler.java (original)
+++ commons/sandbox/graph/branches/modularization/flow/src/main/java/org/apache/commons/graph/flow/FlowNetworkHandler.java Tue May 28 15:00:27 2013
@@ -30,10 +30,10 @@ import org.apache.commons.graph.Directed
 import org.apache.commons.graph.Mapper;
 import org.apache.commons.graph.VertexPair;
 import org.apache.commons.graph.WeightedPath;
-import org.apache.commons.graph.shortestpath.PredecessorsList;
+import org.apache.commons.graph.math.monoid.OrderedMonoid;
+import org.apache.commons.graph.model.PredecessorsList;
 import org.apache.commons.graph.visit.BaseGraphVisitHandler;
 import org.apache.commons.graph.visit.VisitState;
-import org.apache.commons.graph.weight.OrderedMonoid;
 
 /**
  * Provides standard operations for max-flow algorithms,

Added: commons/sandbox/graph/branches/modularization/flow/src/main/java/org/apache/commons/graph/flow/FlowSolver.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/branches/modularization/flow/src/main/java/org/apache/commons/graph/flow/FlowSolver.java?rev=1486948&view=auto
==============================================================================
--- commons/sandbox/graph/branches/modularization/flow/src/main/java/org/apache/commons/graph/flow/FlowSolver.java (added)
+++ commons/sandbox/graph/branches/modularization/flow/src/main/java/org/apache/commons/graph/flow/FlowSolver.java Tue May 28 15:00:27 2013
@@ -0,0 +1,50 @@
+package org.apache.commons.graph.flow;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import static org.apache.commons.graph.utils.Assertions.checkNotNull;
+
+import org.apache.commons.graph.DirectedGraph;
+import org.apache.commons.graph.Graph;
+
+public final class FlowSolver
+{
+
+    /**
+     * Find the maximum flow on the input {@link Graph}.
+     *
+     * @param <V> the Graph vertices type
+     * @param <WE> the Graph edges type
+     * @param <G> the Graph type
+     * @param graph the input edge-weighted graph
+     * @return an instance of {@link FlowWeightedEdgesBuilder}
+     */
+    public static <V, WE, G extends DirectedGraph<V, WE>> FlowWeightedEdgesBuilder<V, WE> findMaxFlow( G graph )
+    {
+        graph = checkNotNull( graph, "Max flow can not be calculated on null graph" );
+        return new DefaultFlowWeightedEdgesBuilder<V, WE>( graph );
+    }
+
+    private FlowSolver()
+    {
+        // do nothing
+    }
+
+}

Propchange: commons/sandbox/graph/branches/modularization/flow/src/main/java/org/apache/commons/graph/flow/FlowSolver.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/graph/branches/modularization/flow/src/main/java/org/apache/commons/graph/flow/FlowSolver.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/graph/branches/modularization/flow/src/main/java/org/apache/commons/graph/flow/FlowSolver.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: commons/sandbox/graph/branches/modularization/flow/src/main/java/org/apache/commons/graph/flow/MaxFlowAlgorithmSelector.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/branches/modularization/flow/src/main/java/org/apache/commons/graph/flow/MaxFlowAlgorithmSelector.java?rev=1486948&r1=1486620&r2=1486948&view=diff
==============================================================================
--- commons/sandbox/graph/branches/modularization/flow/src/main/java/org/apache/commons/graph/flow/MaxFlowAlgorithmSelector.java (original)
+++ commons/sandbox/graph/branches/modularization/flow/src/main/java/org/apache/commons/graph/flow/MaxFlowAlgorithmSelector.java Tue May 28 15:00:27 2013
@@ -19,7 +19,7 @@ package org.apache.commons.graph.flow;
  * under the License.
  */
 
-import org.apache.commons.graph.weight.OrderedMonoid;
+import org.apache.commons.graph.math.monoid.OrderedMonoid;
 
 /**
  * Maximum Flow algorithm selector

Modified: commons/sandbox/graph/branches/modularization/flow/src/test/java/org/apache/commons/graph/flow/EdmondsKarpTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/branches/modularization/flow/src/test/java/org/apache/commons/graph/flow/EdmondsKarpTestCase.java?rev=1486948&r1=1486620&r2=1486948&view=diff
==============================================================================
--- commons/sandbox/graph/branches/modularization/flow/src/test/java/org/apache/commons/graph/flow/EdmondsKarpTestCase.java (original)
+++ commons/sandbox/graph/branches/modularization/flow/src/test/java/org/apache/commons/graph/flow/EdmondsKarpTestCase.java Tue May 28 15:00:27 2013
@@ -19,16 +19,16 @@ package org.apache.commons.graph.flow;
  * under the License.
  */
 
-import static org.apache.commons.graph.CommonsGraph.findMaxFlow;
-import static org.apache.commons.graph.CommonsGraph.newDirectedMutableGraph;
+import static org.apache.commons.graph.flow.FlowSolver.findMaxFlow;
+import static org.apache.commons.graph.model.GraphUtils.newDirectedMutableGraph;
 import static org.junit.Assert.assertEquals;
 
 import org.apache.commons.graph.builder.AbstractGraphConnection;
-import org.apache.commons.graph.model.BaseLabeledVertex;
-import org.apache.commons.graph.model.BaseLabeledWeightedEdge;
-import org.apache.commons.graph.model.BaseWeightedEdge;
+import org.apache.commons.graph.math.monoid.primitive.IntegerWeightBaseOperations;
 import org.apache.commons.graph.model.DirectedMutableGraph;
-import org.apache.commons.graph.weight.primitive.IntegerWeightBaseOperations;
+import org.apache.commons.graph.model.labeled.BaseLabeledVertex;
+import org.apache.commons.graph.model.labeled.BaseLabeledWeightedEdge;
+import org.apache.commons.graph.model.labeled.BaseWeightedEdge;
 import org.junit.Test;
 
 /**

Modified: commons/sandbox/graph/branches/modularization/flow/src/test/java/org/apache/commons/graph/flow/FordFulkersonTestCase.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/branches/modularization/flow/src/test/java/org/apache/commons/graph/flow/FordFulkersonTestCase.java?rev=1486948&r1=1486620&r2=1486948&view=diff
==============================================================================
--- commons/sandbox/graph/branches/modularization/flow/src/test/java/org/apache/commons/graph/flow/FordFulkersonTestCase.java (original)
+++ commons/sandbox/graph/branches/modularization/flow/src/test/java/org/apache/commons/graph/flow/FordFulkersonTestCase.java Tue May 28 15:00:27 2013
@@ -19,16 +19,16 @@ package org.apache.commons.graph.flow;
  * under the License.
  */
 
-import static org.apache.commons.graph.CommonsGraph.findMaxFlow;
-import static org.apache.commons.graph.CommonsGraph.newDirectedMutableGraph;
+import static org.apache.commons.graph.flow.FlowSolver.findMaxFlow;
+import static org.apache.commons.graph.model.GraphUtils.newDirectedMutableGraph;
 import static org.junit.Assert.assertEquals;
 
 import org.apache.commons.graph.builder.AbstractGraphConnection;
-import org.apache.commons.graph.model.BaseLabeledVertex;
-import org.apache.commons.graph.model.BaseLabeledWeightedEdge;
-import org.apache.commons.graph.model.BaseWeightedEdge;
+import org.apache.commons.graph.math.monoid.primitive.IntegerWeightBaseOperations;
 import org.apache.commons.graph.model.DirectedMutableGraph;
-import org.apache.commons.graph.weight.primitive.IntegerWeightBaseOperations;
+import org.apache.commons.graph.model.labeled.BaseLabeledVertex;
+import org.apache.commons.graph.model.labeled.BaseLabeledWeightedEdge;
+import org.apache.commons.graph.model.labeled.BaseWeightedEdge;
 import org.junit.Test;
 
 /**

Propchange: commons/sandbox/graph/branches/modularization/model/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue May 28 15:00:27 2013
@@ -0,0 +1,2 @@
+.settings
+target

Added: commons/sandbox/graph/branches/modularization/model/pom.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/branches/modularization/model/pom.xml?rev=1486948&view=auto
==============================================================================
--- commons/sandbox/graph/branches/modularization/model/pom.xml (added)
+++ commons/sandbox/graph/branches/modularization/model/pom.xml Tue May 28 15:00:27 2013
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.commons</groupId>
+    <artifactId>commons-graph</artifactId>
+    <version>0.1-SNAPSHOT</version>
+  </parent>
+
+  <artifactId>commons-graph-model</artifactId>
+
+  <name>Apache Commons Graph - Model</name>
+  <description>In memory Graph data structures implementation.</description>
+
+  <dependencies>
+    <dependency>
+      <groupId>${project.parent.groupId}</groupId>
+      <artifactId>commons-graph-api</artifactId>
+      <version>${project.parent.version}</version>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <resources>
+      <resource>
+        <directory>${basedir}/../</directory>
+        <targetPath>META-INF</targetPath>
+        <includes>
+          <include>NOTICE.txt</include>
+          <include>LICENSE.txt</include>
+        </includes>
+      </resource>
+    </resources>
+  </build>
+
+</project>

Propchange: commons/sandbox/graph/branches/modularization/model/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/graph/branches/modularization/model/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: commons/sandbox/graph/branches/modularization/model/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Copied: commons/sandbox/graph/branches/modularization/model/src/main/java/org/apache/commons/graph/model/GraphUtils.java (from r1486620, commons/sandbox/graph/branches/modularization/src/test/java/org/apache/commons/graph/utils/GraphUtils.java)
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/branches/modularization/model/src/main/java/org/apache/commons/graph/model/GraphUtils.java?p2=commons/sandbox/graph/branches/modularization/model/src/main/java/org/apache/commons/graph/model/GraphUtils.java&p1=commons/sandbox/graph/branches/modularization/src/test/java/org/apache/commons/graph/utils/GraphUtils.java&r1=1486620&r2=1486948&rev=1486948&view=diff
==============================================================================
--- commons/sandbox/graph/branches/modularization/src/test/java/org/apache/commons/graph/utils/GraphUtils.java (original)
+++ commons/sandbox/graph/branches/modularization/model/src/main/java/org/apache/commons/graph/model/GraphUtils.java Tue May 28 15:00:27 2013
@@ -1,4 +1,4 @@
-package org.apache.commons.graph.utils;
+package org.apache.commons.graph.model;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
@@ -19,16 +19,10 @@ package org.apache.commons.graph.utils;
  * under the License.
  */
 
-import static java.lang.String.format;
-import static java.lang.String.valueOf;
+import static org.apache.commons.graph.Graphs.populate;
 
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.commons.graph.GraphException;
-import org.apache.commons.graph.model.BaseLabeledEdge;
-import org.apache.commons.graph.model.BaseLabeledVertex;
-import org.apache.commons.graph.model.BaseMutableGraph;
+import org.apache.commons.graph.builder.GraphConnection;
+import org.apache.commons.graph.model.DirectedMutableGraph;
 import org.apache.commons.graph.model.UndirectedMutableGraph;
 
 /**
@@ -38,237 +32,31 @@ public class GraphUtils
 {
 
     /**
-     * Creates a complete graph with nVertices
+     * Creates a new {@link DirectedMutableGraph} instance where vertices
+     * are connected as described in the input {@link GraphConnection} instance.
      *
-     * @param nVertices number of vertices
-     * @param g graph
+     * @param <V> the Graph vertices type
+     * @param <E> the Graph edges type
+     * @param graphConnection the {@link GraphConnection} instance that describes vertices
+     * @return a new {@link DirectedMutableGraph} instance
      */
-    public static void buildCompleteGraph( int nVertices, BaseMutableGraph<BaseLabeledVertex, BaseLabeledEdge> g )
+    public static <V, E> DirectedMutableGraph<V, E> newDirectedMutableGraph( GraphConnection<V, E> graphConnection )
     {
-        // building Graph
-        for ( int i = 0; i < nVertices; i++ )
-        {
-            BaseLabeledVertex v = new BaseLabeledVertex( valueOf( i ) );
-            g.addVertex( v );
-        }
-
-        for ( BaseLabeledVertex v1 : g.getVertices() )
-        {
-            for ( BaseLabeledVertex v2 : g.getVertices() )
-            {
-                if ( !v1.equals( v2 ) )
-                {
-                    try
-                    {
-                        g.addEdge( v1, new BaseLabeledEdge( format( "%s -> %s", v1, v2 ) ), v2 );
-                    }
-                    catch ( GraphException e )
-                    {
-                        // ignore
-                    }
-                }
-            }
-        }
+        return populate( new DirectedMutableGraph<V, E>() ).withConnections( graphConnection );
     }
 
     /**
-     * Create a Biparted graph
+     * Creates a new {@link UndirectedMutableGraph} instance where vertices
+     * are connected as described in the input {@link GraphConnection} instance.
      *
-     * @param nVertices number of vertices
-     * @param g graph
+     * @param <V> the Graph vertices type
+     * @param <E> the Graph edges type
+     * @param graphConnection the {@link GraphConnection} instance that describes vertices
+     * @return a new {@link UndirectedMutableGraph} instance
      */
-    public static void buildBipartedGraph( int nVertices, UndirectedMutableGraph<BaseLabeledVertex, BaseLabeledEdge> g )
-    {
-        // building Graph
-        for ( int i = 0; i < nVertices; i++ )
-        {
-            BaseLabeledVertex v = new BaseLabeledVertex( valueOf( i ) );
-            g.addVertex( v );
-        }
-
-        List<BaseLabeledVertex> fistPartition = new ArrayList<BaseLabeledVertex>();
-        List<BaseLabeledVertex> secondPartition = new ArrayList<BaseLabeledVertex>();
-
-        int count = 0;
-        for ( BaseLabeledVertex v1 : g.getVertices() )
-        {
-            if ( count++ == nVertices / 2 )
-            {
-                break;
-            }
-            fistPartition.add( v1 );
-        }
-
-        count = 0;
-        for ( BaseLabeledVertex v2 : g.getVertices() )
-        {
-            if ( count++ < nVertices / 2 )
-            {
-                continue;
-            }
-            secondPartition.add( v2 );
-        }
-
-        for ( BaseLabeledVertex v1 : fistPartition )
-        {
-            for ( BaseLabeledVertex v2 : secondPartition )
-            {
-                if ( !v1.equals( v2 ) )
-                {
-                    try
-                    {
-                        g.addEdge( v1, new BaseLabeledEdge( format( "%s -> %s", v1, v2 ) ), v2 );
-                    }
-                    catch ( GraphException e )
-                    {
-                        // ignore
-                    }
-                }
-            }
-        }
-    }
-
-    public static void buildCrownGraph( int nVertices, UndirectedMutableGraph<BaseLabeledVertex, BaseLabeledEdge> g )
+    public static <V, E> UndirectedMutableGraph<V, E> newUndirectedMutableGraph( GraphConnection<V, E> graphConnection )
     {
-        List<BaseLabeledVertex> tmp = new ArrayList<BaseLabeledVertex>();
-
-        for ( int i = 0; i < nVertices; i++ )
-        {
-            BaseLabeledVertex v = new BaseLabeledVertex( valueOf( i ) );
-            g.addVertex( v );
-            tmp.add( v );
-        }
-
-        for ( int i = 0; i < nVertices; i++ )
-        {
-            int next = i + 1;
-            if ( i == ( nVertices - 1 ) )
-            {
-                next = 0;
-            }
-            BaseLabeledEdge e = new BaseLabeledEdge( format( "%s -> %s", i, next ) );
-            try
-            {
-                g.addEdge( tmp.get( i ), e, tmp.get( next ) );
-            }
-            catch ( GraphException ge )
-            {
-                // ignore
-            }
-        }
-    }
-
-    /**
-     * Creates a graph that contains all classic sudoku contratints.
-     *
-     * @return
-     */
-    public static BaseLabeledVertex[][] buildSudokuGraph( UndirectedMutableGraph<BaseLabeledVertex, BaseLabeledEdge> sudoku )
-    {
-        BaseLabeledVertex[][] grid = new BaseLabeledVertex[9][9];
-        // build sudoku grid.
-        for ( int row = 0; row < 9; row++ )
-        {
-            for ( int col = 0; col < 9; col++ )
-            {
-                grid[row][col] = new BaseLabeledVertex( format( "%s, %s", row, col ) );
-                sudoku.addVertex( grid[row][col] );
-            }
-        }
-
-        int[] rowsOffsets = new int[] { 0, 3, 6 };
-        int[] colsOffsets = new int[] { 0, 3, 6 };
-
-        // build constraint.
-        for ( int rof = 0; rof < 3; rof++ )
-        {
-            for ( int cof = 0; cof < 3; cof++ )
-            {
-                List<BaseLabeledVertex> boxes = new ArrayList<BaseLabeledVertex>();
-                for ( int row = rowsOffsets[rof]; row < 3 + rowsOffsets[rof]; row++ )
-                {
-                    for ( int col = colsOffsets[cof]; col < 3 + colsOffsets[cof]; col++ )
-                    {
-                        boxes.add( grid[row][col] );
-                    }
-                }
-
-                for ( BaseLabeledVertex v1 : boxes )
-                {
-                    for ( BaseLabeledVertex v2 : boxes )
-                    {
-
-                        BaseLabeledEdge e = new BaseLabeledEdge( format( "%s -> %s", v1, v2 ) );
-                        if ( !v1.equals( v2 ) )
-                        {
-                            try
-                            {
-                                sudoku.addEdge( v1, e, v2 );
-                            }
-                            catch ( GraphException ge )
-                            {
-                                // ignore
-                            }
-                        }
-                    }
-                }
-            }
-        }
-
-        // create rows constraint
-        for ( int j = 0; j < 9; j++ )
-        {
-            for ( int i = 0; i < 9; i++ )
-            {
-                for ( int h = 0; h < 9; h++ )
-                {
-                    BaseLabeledVertex v1 = grid[j][i];
-                    BaseLabeledVertex v2 = grid[j][h];
-
-                    if ( !v1.equals( v2 ) )
-                    {
-                        BaseLabeledEdge e = new BaseLabeledEdge( format( "%s -> %s", v1, v2 ) );
-                        try
-                        {
-                            sudoku.addEdge( v1, e, v2 );
-                        }
-                        catch ( GraphException ge )
-                        {
-                            // ignore
-                        }
-                    }
-
-                }
-            }
-        }
-
-        // create cols constraint
-        for ( int j = 0; j < 9; j++ )
-        {
-            for ( int i = 0; i < 9; i++ )
-            {
-                for ( int h = 0; h < 9; h++ )
-                {
-                    BaseLabeledVertex v1 = grid[i][j];
-                    BaseLabeledVertex v2 = grid[h][j];
-
-                    if ( !v1.equals( v2 ) )
-                    {
-                        BaseLabeledEdge e = new BaseLabeledEdge( format( "%s -> %s", v1, v2 ) );
-                        try
-                        {
-                            sudoku.addEdge( v1, e, v2 );
-                        }
-                        catch ( GraphException ge )
-                        {
-                            // ignore
-                        }
-                    }
-
-                }
-            }
-        }
-        return grid;
+        return populate( new UndirectedMutableGraph<V, E>() ).withConnections( graphConnection );
     }
 
     /**

Copied: commons/sandbox/graph/branches/modularization/model/src/main/java/org/apache/commons/graph/model/InMemoryWeightedPath.java (from r1486530, commons/sandbox/graph/branches/modularization/src/main/java/org/apache/commons/graph/model/InMemoryWeightedPath.java)
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/branches/modularization/model/src/main/java/org/apache/commons/graph/model/InMemoryWeightedPath.java?p2=commons/sandbox/graph/branches/modularization/model/src/main/java/org/apache/commons/graph/model/InMemoryWeightedPath.java&p1=commons/sandbox/graph/branches/modularization/src/main/java/org/apache/commons/graph/model/InMemoryWeightedPath.java&r1=1486530&r2=1486948&rev=1486948&view=diff
==============================================================================
--- commons/sandbox/graph/branches/modularization/src/main/java/org/apache/commons/graph/model/InMemoryWeightedPath.java (original)
+++ commons/sandbox/graph/branches/modularization/model/src/main/java/org/apache/commons/graph/model/InMemoryWeightedPath.java Tue May 28 15:00:27 2013
@@ -24,7 +24,7 @@ import static org.apache.commons.graph.u
 
 import org.apache.commons.graph.Mapper;
 import org.apache.commons.graph.WeightedPath;
-import org.apache.commons.graph.weight.Monoid;
+import org.apache.commons.graph.math.monoid.Monoid;
 
 /**
  * Support {@link WeightedPath} implementation, optimized for algorithms (such Dijkstra's) that need to rebuild the path
@@ -49,10 +49,10 @@ public final class InMemoryWeightedPath<
 
     /**
      * Creates a new instance of {@link InMemoryWeightedPath}.
-     * 
+     *
      * @param start the start vertex
      * @param target the target vertex
-     * @param weightOperations 
+     * @param weightOperations
      * @param weightedEdges
      */
     public InMemoryWeightedPath( V start, V target, Monoid<W> weightOperations, Mapper<WE, W> weightedEdges )

Copied: commons/sandbox/graph/branches/modularization/model/src/main/java/org/apache/commons/graph/model/MutableSpanningTree.java (from r1486530, commons/sandbox/graph/branches/modularization/src/main/java/org/apache/commons/graph/model/MutableSpanningTree.java)
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/branches/modularization/model/src/main/java/org/apache/commons/graph/model/MutableSpanningTree.java?p2=commons/sandbox/graph/branches/modularization/model/src/main/java/org/apache/commons/graph/model/MutableSpanningTree.java&p1=commons/sandbox/graph/branches/modularization/src/main/java/org/apache/commons/graph/model/MutableSpanningTree.java&r1=1486530&r2=1486948&rev=1486948&view=diff
==============================================================================
--- commons/sandbox/graph/branches/modularization/src/main/java/org/apache/commons/graph/model/MutableSpanningTree.java (original)
+++ commons/sandbox/graph/branches/modularization/model/src/main/java/org/apache/commons/graph/model/MutableSpanningTree.java Tue May 28 15:00:27 2013
@@ -21,7 +21,7 @@ package org.apache.commons.graph.model;
 
 import org.apache.commons.graph.Mapper;
 import org.apache.commons.graph.SpanningTree;
-import org.apache.commons.graph.weight.Monoid;
+import org.apache.commons.graph.math.monoid.Monoid;
 
 /**
  * A memory-based implementation of a mutable spanning tree.
@@ -47,8 +47,8 @@ public final class MutableSpanningTree<V
 
     /**
      * Creates a new instance of {@link MutableSpanningTree}
-     * 
-     * @param weightOperations 
+     *
+     * @param weightOperations
      * @param weightedEdges
      */
     public MutableSpanningTree( Monoid<W> weightOperations, Mapper<WE, W> weightedEdges )

Copied: commons/sandbox/graph/branches/modularization/model/src/main/java/org/apache/commons/graph/model/PathNotFoundException.java (from r1486620, commons/sandbox/graph/branches/modularization/src/main/java/org/apache/commons/graph/shortestpath/PathNotFoundException.java)
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/branches/modularization/model/src/main/java/org/apache/commons/graph/model/PathNotFoundException.java?p2=commons/sandbox/graph/branches/modularization/model/src/main/java/org/apache/commons/graph/model/PathNotFoundException.java&p1=commons/sandbox/graph/branches/modularization/src/main/java/org/apache/commons/graph/shortestpath/PathNotFoundException.java&r1=1486620&r2=1486948&rev=1486948&view=diff
==============================================================================
--- commons/sandbox/graph/branches/modularization/src/main/java/org/apache/commons/graph/shortestpath/PathNotFoundException.java (original)
+++ commons/sandbox/graph/branches/modularization/model/src/main/java/org/apache/commons/graph/model/PathNotFoundException.java Tue May 28 15:00:27 2013
@@ -1,4 +1,4 @@
-package org.apache.commons.graph.shortestpath;
+package org.apache.commons.graph.model;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one

Copied: commons/sandbox/graph/branches/modularization/model/src/main/java/org/apache/commons/graph/model/PredecessorsList.java (from r1486620, commons/sandbox/graph/branches/modularization/src/main/java/org/apache/commons/graph/shortestpath/PredecessorsList.java)
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/branches/modularization/model/src/main/java/org/apache/commons/graph/model/PredecessorsList.java?p2=commons/sandbox/graph/branches/modularization/model/src/main/java/org/apache/commons/graph/model/PredecessorsList.java&p1=commons/sandbox/graph/branches/modularization/src/main/java/org/apache/commons/graph/shortestpath/PredecessorsList.java&r1=1486620&r2=1486948&rev=1486948&view=diff
==============================================================================
--- commons/sandbox/graph/branches/modularization/src/main/java/org/apache/commons/graph/shortestpath/PredecessorsList.java (original)
+++ commons/sandbox/graph/branches/modularization/model/src/main/java/org/apache/commons/graph/model/PredecessorsList.java Tue May 28 15:00:27 2013
@@ -1,4 +1,4 @@
-package org.apache.commons.graph.shortestpath;
+package org.apache.commons.graph.model;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
@@ -25,8 +25,8 @@ import java.util.Map;
 import org.apache.commons.graph.Graph;
 import org.apache.commons.graph.Mapper;
 import org.apache.commons.graph.WeightedPath;
+import org.apache.commons.graph.math.monoid.Monoid;
 import org.apache.commons.graph.model.InMemoryWeightedPath;
-import org.apache.commons.graph.weight.Monoid;
 
 /**
  * The predecessor list is a list of vertex of a {@link org.apache.commons.graph.Graph}.

Copied: commons/sandbox/graph/branches/modularization/model/src/main/java/org/apache/commons/graph/model/labeled/BaseLabeledEdge.java (from r1486530, commons/sandbox/graph/branches/modularization/src/test/java/org/apache/commons/graph/model/BaseLabeledEdge.java)
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/branches/modularization/model/src/main/java/org/apache/commons/graph/model/labeled/BaseLabeledEdge.java?p2=commons/sandbox/graph/branches/modularization/model/src/main/java/org/apache/commons/graph/model/labeled/BaseLabeledEdge.java&p1=commons/sandbox/graph/branches/modularization/src/test/java/org/apache/commons/graph/model/BaseLabeledEdge.java&r1=1486530&r2=1486948&rev=1486948&view=diff
==============================================================================
--- commons/sandbox/graph/branches/modularization/src/test/java/org/apache/commons/graph/model/BaseLabeledEdge.java (original)
+++ commons/sandbox/graph/branches/modularization/model/src/main/java/org/apache/commons/graph/model/labeled/BaseLabeledEdge.java Tue May 28 15:00:27 2013
@@ -1,4 +1,4 @@
-package org.apache.commons.graph.model;
+package org.apache.commons.graph.model.labeled;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one

Copied: commons/sandbox/graph/branches/modularization/model/src/main/java/org/apache/commons/graph/model/labeled/BaseLabeledVertex.java (from r1486530, commons/sandbox/graph/branches/modularization/src/test/java/org/apache/commons/graph/model/BaseLabeledVertex.java)
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/branches/modularization/model/src/main/java/org/apache/commons/graph/model/labeled/BaseLabeledVertex.java?p2=commons/sandbox/graph/branches/modularization/model/src/main/java/org/apache/commons/graph/model/labeled/BaseLabeledVertex.java&p1=commons/sandbox/graph/branches/modularization/src/test/java/org/apache/commons/graph/model/BaseLabeledVertex.java&r1=1486530&r2=1486948&rev=1486948&view=diff
==============================================================================
--- commons/sandbox/graph/branches/modularization/src/test/java/org/apache/commons/graph/model/BaseLabeledVertex.java (original)
+++ commons/sandbox/graph/branches/modularization/model/src/main/java/org/apache/commons/graph/model/labeled/BaseLabeledVertex.java Tue May 28 15:00:27 2013
@@ -1,4 +1,4 @@
-package org.apache.commons.graph.model;
+package org.apache.commons.graph.model.labeled;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one

Copied: commons/sandbox/graph/branches/modularization/model/src/main/java/org/apache/commons/graph/model/labeled/BaseLabeledWeightedEdge.java (from r1486530, commons/sandbox/graph/branches/modularization/src/test/java/org/apache/commons/graph/model/BaseLabeledWeightedEdge.java)
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/branches/modularization/model/src/main/java/org/apache/commons/graph/model/labeled/BaseLabeledWeightedEdge.java?p2=commons/sandbox/graph/branches/modularization/model/src/main/java/org/apache/commons/graph/model/labeled/BaseLabeledWeightedEdge.java&p1=commons/sandbox/graph/branches/modularization/src/test/java/org/apache/commons/graph/model/BaseLabeledWeightedEdge.java&r1=1486530&r2=1486948&rev=1486948&view=diff
==============================================================================
--- commons/sandbox/graph/branches/modularization/src/test/java/org/apache/commons/graph/model/BaseLabeledWeightedEdge.java (original)
+++ commons/sandbox/graph/branches/modularization/model/src/main/java/org/apache/commons/graph/model/labeled/BaseLabeledWeightedEdge.java Tue May 28 15:00:27 2013
@@ -1,4 +1,4 @@
-package org.apache.commons.graph.model;
+package org.apache.commons.graph.model.labeled;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one

Copied: commons/sandbox/graph/branches/modularization/model/src/main/java/org/apache/commons/graph/model/labeled/BaseWeightedEdge.java (from r1486530, commons/sandbox/graph/branches/modularization/src/test/java/org/apache/commons/graph/model/BaseWeightedEdge.java)
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/branches/modularization/model/src/main/java/org/apache/commons/graph/model/labeled/BaseWeightedEdge.java?p2=commons/sandbox/graph/branches/modularization/model/src/main/java/org/apache/commons/graph/model/labeled/BaseWeightedEdge.java&p1=commons/sandbox/graph/branches/modularization/src/test/java/org/apache/commons/graph/model/BaseWeightedEdge.java&r1=1486530&r2=1486948&rev=1486948&view=diff
==============================================================================
--- commons/sandbox/graph/branches/modularization/src/test/java/org/apache/commons/graph/model/BaseWeightedEdge.java (original)
+++ commons/sandbox/graph/branches/modularization/model/src/main/java/org/apache/commons/graph/model/labeled/BaseWeightedEdge.java Tue May 28 15:00:27 2013
@@ -1,4 +1,4 @@
-package org.apache.commons.graph.model;
+package org.apache.commons.graph.model.labeled;
 
 /*
  * Licensed to the Apache Software Foundation (ASF) under one

Copied: commons/sandbox/graph/branches/modularization/model/src/test/java/org/apache/commons/graph/builder/GraphBuilderTestCase.java (from r1486620, commons/sandbox/graph/branches/modularization/src/test/java/org/apache/commons/graph/builder/GraphBuilderTestCase.java)
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/branches/modularization/model/src/test/java/org/apache/commons/graph/builder/GraphBuilderTestCase.java?p2=commons/sandbox/graph/branches/modularization/model/src/test/java/org/apache/commons/graph/builder/GraphBuilderTestCase.java&p1=commons/sandbox/graph/branches/modularization/src/test/java/org/apache/commons/graph/builder/GraphBuilderTestCase.java&r1=1486620&r2=1486948&rev=1486948&view=diff
==============================================================================
--- commons/sandbox/graph/branches/modularization/src/test/java/org/apache/commons/graph/builder/GraphBuilderTestCase.java (original)
+++ commons/sandbox/graph/branches/modularization/model/src/test/java/org/apache/commons/graph/builder/GraphBuilderTestCase.java Tue May 28 15:00:27 2013
@@ -19,12 +19,12 @@ package org.apache.commons.graph.builder
  * under the License.
  */
 
-import static org.apache.commons.graph.CommonsGraph.newUndirectedMutableGraph;
+import static org.apache.commons.graph.model.GraphUtils.newUndirectedMutableGraph;
 import static org.junit.Assert.assertEquals;
 
-import org.apache.commons.graph.model.BaseLabeledVertex;
-import org.apache.commons.graph.model.BaseLabeledWeightedEdge;
 import org.apache.commons.graph.model.UndirectedMutableGraph;
+import org.apache.commons.graph.model.labeled.BaseLabeledVertex;
+import org.apache.commons.graph.model.labeled.BaseLabeledWeightedEdge;
 import org.junit.Test;
 
 public final class GraphBuilderTestCase

Copied: commons/sandbox/graph/branches/modularization/model/src/test/java/org/apache/commons/graph/model/BaseMutableGraphTestCase.java (from r1486530, commons/sandbox/graph/branches/modularization/src/test/java/org/apache/commons/graph/model/BaseMutableGraphTestCase.java)
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/branches/modularization/model/src/test/java/org/apache/commons/graph/model/BaseMutableGraphTestCase.java?p2=commons/sandbox/graph/branches/modularization/model/src/test/java/org/apache/commons/graph/model/BaseMutableGraphTestCase.java&p1=commons/sandbox/graph/branches/modularization/src/test/java/org/apache/commons/graph/model/BaseMutableGraphTestCase.java&r1=1486530&r2=1486948&rev=1486948&view=diff
==============================================================================
--- commons/sandbox/graph/branches/modularization/src/test/java/org/apache/commons/graph/model/BaseMutableGraphTestCase.java (original)
+++ commons/sandbox/graph/branches/modularization/model/src/test/java/org/apache/commons/graph/model/BaseMutableGraphTestCase.java Tue May 28 15:00:27 2013
@@ -19,8 +19,9 @@ package org.apache.commons.graph.model;
  * under the License.
  */
 
+import static java.lang.String.format;
 import static java.lang.String.valueOf;
-import static org.apache.commons.graph.utils.GraphUtils.buildCompleteGraph;
+import static org.apache.commons.graph.Graphs.synchronize;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
@@ -30,11 +31,10 @@ import static org.junit.Assert.fail;
 import java.util.ArrayList;
 import java.util.List;
 
-import org.apache.commons.graph.CommonsGraph;
 import org.apache.commons.graph.GraphException;
 import org.apache.commons.graph.MutableGraph;
-import org.apache.commons.graph.utils.MultiThreadedTestRunner;
-import org.apache.commons.graph.utils.TestRunner;
+import org.apache.commons.graph.model.labeled.BaseLabeledEdge;
+import org.apache.commons.graph.model.labeled.BaseLabeledVertex;
 import org.junit.Test;
 
 /**
@@ -377,7 +377,7 @@ public class BaseMutableGraphTestCase
         throws Throwable
     {
         final MutableGraph<BaseLabeledVertex, BaseLabeledEdge> g =
-            (MutableGraph<BaseLabeledVertex, BaseLabeledEdge>) CommonsGraph.synchronize( (MutableGraph<BaseLabeledVertex, BaseLabeledEdge>) new UndirectedMutableGraph<BaseLabeledVertex, BaseLabeledEdge>() );
+            (MutableGraph<BaseLabeledVertex, BaseLabeledEdge>) synchronize( (MutableGraph<BaseLabeledVertex, BaseLabeledEdge>) new UndirectedMutableGraph<BaseLabeledVertex, BaseLabeledEdge>() );
 
         TestRunner tr1, tr2, tr3;
         tr1 = new GraphInsert( g, 0, 10 );
@@ -403,7 +403,7 @@ public class BaseMutableGraphTestCase
         throws Throwable
     {
         final MutableGraph<BaseLabeledVertex, BaseLabeledEdge> g =
-            (MutableGraph<BaseLabeledVertex, BaseLabeledEdge>) CommonsGraph.synchronize( (MutableGraph<BaseLabeledVertex, BaseLabeledEdge>) new DirectedMutableGraph<BaseLabeledVertex, BaseLabeledEdge>() );
+            (MutableGraph<BaseLabeledVertex, BaseLabeledEdge>) synchronize( (MutableGraph<BaseLabeledVertex, BaseLabeledEdge>) new DirectedMutableGraph<BaseLabeledVertex, BaseLabeledEdge>() );
 
         TestRunner tr1, tr2, tr3;
         tr1 = new GraphInsert( g, 0, 10 );
@@ -472,4 +472,39 @@ public class BaseMutableGraphTestCase
             }
         }
     }
+
+    /**
+     * Creates a complete graph with nVertices
+     *
+     * @param nVertices number of vertices
+     * @param g graph
+     */
+    private static void buildCompleteGraph( int nVertices, BaseMutableGraph<BaseLabeledVertex, BaseLabeledEdge> g )
+    {
+        // building Graph
+        for ( int i = 0; i < nVertices; i++ )
+        {
+            BaseLabeledVertex v = new BaseLabeledVertex( valueOf( i ) );
+            g.addVertex( v );
+        }
+
+        for ( BaseLabeledVertex v1 : g.getVertices() )
+        {
+            for ( BaseLabeledVertex v2 : g.getVertices() )
+            {
+                if ( !v1.equals( v2 ) )
+                {
+                    try
+                    {
+                        g.addEdge( v1, new BaseLabeledEdge( format( "%s -> %s", v1, v2 ) ), v2 );
+                    }
+                    catch ( GraphException e )
+                    {
+                        // ignore
+                    }
+                }
+            }
+        }
+    }
+
 }



Mime
View raw message