提交 d3df8dca 编写于 作者: F Fabian Hueske

Improved Java examples

上级 a6d188cd
......@@ -38,7 +38,8 @@ import eu.stratosphere.example.java.clustering.util.KMeansData;
* Subsequently, each cluster center is moved to the center (<i>mean</i>) of all points that have been assigned to it.
* The moved cluster centers are fed into the next iteration.
* The algorithm terminates after a fixed number of iterations (as in this implementation)
* or if cluster centers do not (significantly) move in an iteration.
* or if cluster centers do not (significantly) move in an iteration.<br>
* This is the Wikipedia entry for the <a href="http://en.wikipedia.org/wiki/K-means_clustering">K-Means Clustering algorithm</a>.
*
* <p>
* This implementation works on two-dimensional data points. <br>
......@@ -290,6 +291,8 @@ public class KMeans {
} else {
System.out.println("Executing K-Means example with default parameters and built-in default data.");
System.out.println(" Provide parameters to read input data from files.");
System.out.println(" See the documentation for the correct format of input files.");
System.out.println(" We provide a data generator to create synthetic input files for this program.");
System.out.println(" Usage: KMeans <points path> <centers path> <result path> <num iterations>");
}
}
......
......@@ -31,15 +31,18 @@ import eu.stratosphere.util.Collector;
/**
* An implementation of the connected components algorithm, using a delta iteration.
* Initially, the algorithm assigns each vertex its own ID. After the algorithm has completed, all vertices in the
* same component will have the same id. In each step, a vertex picks the minimum of its own ID and its
* neighbors' IDs, as its new ID.
*
* <p>
* Initially, the algorithm assigns each vertex an unique ID. In each step, a vertex picks the minimum of its own ID and its
* neighbors' IDs, as its new ID and tells its neighbors about its new ID. After the algorithm has completed, all vertices in the
* same component will have the same ID.
*
* <p>
* A vertex whose component did not change needs not propagate its information in the next step. Because of that,
* A vertex whose component ID did not change needs not propagate its information in the next step. Because of that,
* the algorithm is easily expressible via a delta iteration. We here model the solution set as the vertices with
* their current component ids, and the workset as the changed vertices. Because we see all vertices initially as
* changed, the initial workset and the initial solution set are identical. Also, the delta to the solution set
* is consequently also the next workset.
* is consequently also the next workset.<br>
*
* <p>
* Input files are plain text files and must be formatted as follows:
......@@ -180,6 +183,7 @@ public class ConnectedComponents implements ProgramDescription {
} else {
System.out.println("Executing Connected Components example with default parameters and built-in default data.");
System.out.println(" Provide parameters to read input data from files.");
System.out.println(" See the documentation for the correct format of input files.");
System.out.println(" Usage: ConnectedComponents <vertices path> <edges path> <result path> <max number of iterations>");
}
}
......
......@@ -198,6 +198,7 @@ public class EnumTrianglesBasic {
} else {
System.out.println("Executing Enum Triangles Basic example with built-in default data.");
System.out.println(" Provide parameters to read input data from files.");
System.out.println(" See the documentation for the correct format of input files.");
System.out.println(" Usage: EnumTriangleBasic <edge path> <result path>");
}
}
......
......@@ -322,6 +322,7 @@ public class EnumTrianglesOpt {
} else {
System.out.println("Executing Enum Triangles Opt example with built-in default data.");
System.out.println(" Provide parameters to read input data from files.");
System.out.println(" See the documentation for the correct format of input files.");
System.out.println(" Usage: EnumTriangleBasic <edge path> <result path>");
}
}
......
......@@ -31,7 +31,7 @@ import eu.stratosphere.example.java.graph.util.PageRankData;
import eu.stratosphere.util.Collector;
/**
* A basic implementation of the page rank algorithm using a bulk iteration.
* A basic implementation of the Page Rank algorithm using a bulk iteration.
*
* <p>
* This implementation requires a set of pages (vertices) with associated ranks and a set
......@@ -39,7 +39,8 @@ import eu.stratosphere.util.Collector;
* In each iteration, the rank of every page is evenly distributed to all pages it points to.
* Each page collects the partial ranks of all pages that point to it, sums them up, and applies a dampening factor to the sum.
* The result is the new rank of the page. A new iteration is started with the new ranks of all pages.
* This implementation terminates after a fixed number of iterations.
* This implementation terminates after a fixed number of iterations.<br>
* This is the Wikipedia entry for the <a href="http://en.wikipedia.org/wiki/Page_rank">Page Rank algorithm</a>.
*
* <p>
* Input files are plain text files and must be formatted as follows:
......@@ -216,6 +217,7 @@ public class PageRankBasic {
} else {
System.out.println("Executing PageRank Basic example with default parameters and built-in default data.");
System.out.println(" Provide parameters to read input data from files.");
System.out.println(" See the documentation for the correct format of input files.");
System.out.println(" Usage: PageRankBasic <vertex with initial rank input> <edges path> <output path> <num vertices> <num iterations>");
numVertices = PageRankData.getNumberOfPages();
......
......@@ -275,6 +275,8 @@ public class WebLogAnalysis {
} else {
System.out.println("Executing WebLog Analysis example with built-in default data.");
System.out.println(" Provide parameters to read input data from files.");
System.out.println(" See the documentation for the correct format of input files.");
System.out.println(" We provide a data generator to create synthetic input files for this program.");
System.out.println(" Usage: WebLogAnalysis <documents path> <ranks path> <visits path> <result path>");
}
}
......
......@@ -27,7 +27,7 @@ import eu.stratosphere.util.Collector;
* over text files.
*
* <p>
* The input is plain text files.
* The input is a plain text file with lines separated by newline characters.
*
* <p>
* This example shows how to:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册