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 2011/06/16 16:07:41 UTC

svn commit: r1136444 - /commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/Prim.java

Author: simonetripodi
Date: Thu Jun 16 14:07:41 2011
New Revision: 1136444

URL: http://svn.apache.org/viewvc?rev=1136444&view=rev
Log:
Prim's algorithms create a spanning tree (forest)
added missing javadoc

Modified:
    commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/Prim.java

Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/Prim.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/Prim.java?rev=1136444&r1=1136443&r2=1136444&view=diff
==============================================================================
--- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/Prim.java (original)
+++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/spanning/Prim.java Thu Jun 16 14:07:41 2011
@@ -19,19 +19,28 @@ package org.apache.commons.graph.spannin
  * under the License.
  */
 
+import org.apache.commons.graph.Graph;
 import org.apache.commons.graph.Vertex;
 import org.apache.commons.graph.WeightedEdge;
 import org.apache.commons.graph.WeightedGraph;
 
 /**
- * 
+ * Prim's algorithm is a greedy algorithm that finds a minimum spanning tree for a connected weighted undirected graph.
  */
 public final class Prim
 {
 
-    public static <V extends Vertex, WE extends WeightedEdge<V>> void minimumSpanningTree(  WeightedGraph<V, WE> graph )
+    /**
+     * Calculates the minimum spanning tree (or forest) of the input Graph.
+     *
+     * @param <V> the Graph vertices type.
+     * @param <WE> the Graph weighted edges type.
+     * @param graph the Graph for which minimum spanning tree (or forest) has to be calculated.
+     * @return  the minimum spanning tree (or forest) of the input Graph.
+     */
+    public static <V extends Vertex, WE extends WeightedEdge<V>> Graph<V, WE> minimumSpanningTree( WeightedGraph<V, WE> graph )
     {
-        
+        return null;
     }
 
 }