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

svn commit: r1235373 - in /commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph: CommonsGraph.java flow/FromHeadBuilder.java flow/MaxFlowAlgorithmSelector.java flow/ToTailBuilder.java

Author: simonetripodi
Date: Tue Jan 24 17:41:40 2012
New Revision: 1235373

URL: http://svn.apache.org/viewvc?rev=1235373&view=rev
Log:
started adding MaxFlow APIs

Added:
    commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/flow/FromHeadBuilder.java   (with props)
    commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/flow/MaxFlowAlgorithmSelector.java   (with props)
    commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/flow/ToTailBuilder.java   (with props)
Modified:
    commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/CommonsGraph.java

Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/CommonsGraph.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/CommonsGraph.java?rev=1235373&r1=1235372&r2=1235373&view=diff
==============================================================================
--- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/CommonsGraph.java (original)
+++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/CommonsGraph.java Tue Jan 24 17:41:40 2012
@@ -28,6 +28,7 @@ import org.apache.commons.graph.coloring
 import org.apache.commons.graph.coloring.DefaultColorsBuilder;
 import org.apache.commons.graph.export.DefaultToStreamBuilder;
 import org.apache.commons.graph.export.ToStreamBuilder;
+import org.apache.commons.graph.flow.FromHeadBuilder;
 import org.apache.commons.graph.model.DirectedMutableGraph;
 import org.apache.commons.graph.model.DirectedMutableWeightedGraph;
 import org.apache.commons.graph.model.UndirectedMutableGraph;
@@ -59,6 +60,21 @@ public final class CommonsGraph<V extend
     }
 
     /**
+     * Find the maximum flow on the input {@link Graph}.
+     *
+     * @param <V>
+     * @param <W>
+     * @param <WE>
+     * @param <G>
+     * @param graph the input edge-weighted graph
+     * @return
+     */
+    public static <V extends Vertex, W, WE extends WeightedEdge<W>, G extends DirectedGraph<V, WE>> FromHeadBuilder<V, W, WE, G> findMaxFlow( final G graph )
+    {
+        return null;
+    }
+
+    /**
      * Allows select a series of algorithms to apply on input graph.
      *
      * @param <V> the Graph vertices type

Added: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/flow/FromHeadBuilder.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/flow/FromHeadBuilder.java?rev=1235373&view=auto
==============================================================================
--- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/flow/FromHeadBuilder.java (added)
+++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/flow/FromHeadBuilder.java Tue Jan 24 17:41:40 2012
@@ -0,0 +1,37 @@
+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 org.apache.commons.graph.DirectedGraph;
+import org.apache.commons.graph.Vertex;
+import org.apache.commons.graph.WeightedEdge;
+
+public interface FromHeadBuilder<V extends Vertex, W, WE extends WeightedEdge<W>, G extends DirectedGraph<V, WE>>
+{
+
+    /**
+     *
+     *
+     * @param head
+     * @return
+     */
+    ToTailBuilder<V, W, WE, G> from( V head );
+
+}

Propchange: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/flow/FromHeadBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

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

Added: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/flow/MaxFlowAlgorithmSelector.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/flow/MaxFlowAlgorithmSelector.java?rev=1235373&view=auto
==============================================================================
--- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/flow/MaxFlowAlgorithmSelector.java (added)
+++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/flow/MaxFlowAlgorithmSelector.java Tue Jan 24 17:41:40 2012
@@ -0,0 +1,46 @@
+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 org.apache.commons.graph.DirectedGraph;
+import org.apache.commons.graph.Vertex;
+import org.apache.commons.graph.WeightedEdge;
+import org.apache.commons.graph.weight.OrderedMonoid;
+
+public interface MaxFlowAlgorithmSelector<V extends Vertex, W, WE extends WeightedEdge<W>, G extends DirectedGraph<V, WE>>
+{
+
+    /**
+     *
+     *
+     * @param orderedMonoid
+     * @return
+     */
+    W applyingFordFulkerson( OrderedMonoid<W> orderedMonoid );
+
+    /**
+     *
+     *
+     * @param orderedMonoid
+     * @return
+     */
+    W applyingEdmondsKarp( OrderedMonoid<W> orderedMonoid );
+
+}

Propchange: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/flow/MaxFlowAlgorithmSelector.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

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

Added: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/flow/ToTailBuilder.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/flow/ToTailBuilder.java?rev=1235373&view=auto
==============================================================================
--- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/flow/ToTailBuilder.java (added)
+++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/flow/ToTailBuilder.java Tue Jan 24 17:41:40 2012
@@ -0,0 +1,37 @@
+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 org.apache.commons.graph.DirectedGraph;
+import org.apache.commons.graph.Vertex;
+import org.apache.commons.graph.WeightedEdge;
+
+public interface ToTailBuilder<V extends Vertex, W, WE extends WeightedEdge<W>, G extends DirectedGraph<V, WE>>
+{
+
+    /**
+     *
+     *
+     * @param head
+     * @return
+     */
+    MaxFlowAlgorithmSelector<V, W, WE, G> to( V head );
+
+}

Propchange: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/flow/ToTailBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

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