You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ch...@apache.org on 2017/05/26 19:16:18 UTC
[09/15] flink git commit: [FLINK-6709] [gelly] Activate strict
checkstyle for flink-gellies
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/asm/translate/translators/LongValueAddOffset.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/asm/translate/translators/LongValueAddOffset.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/asm/translate/translators/LongValueAddOffset.java
index d44ece4..d9a881a 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/asm/translate/translators/LongValueAddOffset.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/asm/translate/translators/LongValueAddOffset.java
@@ -32,7 +32,7 @@ implements TranslateFunction<LongValue, LongValue> {
/**
* Translate {@link LongValue} by adding a constant offset value.
*
- * The summation is *not* checked for overflow or underflow.
+ * <p>The summation is *not* checked for overflow or underflow.
*
* @param offset value to be added to each element
*/
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/asm/translate/translators/LongValueToSignedIntValue.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/asm/translate/translators/LongValueToSignedIntValue.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/asm/translate/translators/LongValueToSignedIntValue.java
index 30a74df..ef66307 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/asm/translate/translators/LongValueToSignedIntValue.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/asm/translate/translators/LongValueToSignedIntValue.java
@@ -26,7 +26,7 @@ import org.apache.flink.util.MathUtils;
/**
* Translate {@link LongValue} to {@link IntValue}.
*
- * Throws {@link RuntimeException} for integer overflow.
+ * <p>Throws {@link RuntimeException} for integer overflow.
*/
public class LongValueToSignedIntValue
implements TranslateFunction<LongValue, IntValue> {
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/asm/translate/translators/LongValueToUnsignedIntValue.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/asm/translate/translators/LongValueToUnsignedIntValue.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/asm/translate/translators/LongValueToUnsignedIntValue.java
index 741bd62..d7896d3 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/asm/translate/translators/LongValueToUnsignedIntValue.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/asm/translate/translators/LongValueToUnsignedIntValue.java
@@ -25,7 +25,7 @@ import org.apache.flink.types.LongValue;
/**
* Translate {@link LongValue} to {@link IntValue}.
*
- * Throws {@link RuntimeException} for integer overflow.
+ * <p>Throws {@link RuntimeException} for integer overflow.
*/
public class LongValueToUnsignedIntValue
implements TranslateFunction<LongValue, IntValue> {
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/bipartite/BipartiteGraph.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/bipartite/BipartiteGraph.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/bipartite/BipartiteGraph.java
index b325103..029e2c4 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/bipartite/BipartiteGraph.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/bipartite/BipartiteGraph.java
@@ -118,9 +118,9 @@ public class BipartiteGraph<KT, KB, VVT, VVB, EV> {
* in the new graph will exist only if the original bipartite graph contains a bottom vertex they are both
* connected to.
*
- * The simple projection performs a single join and returns edges containing the bipartite edge values.
+ * <p>The simple projection performs a single join and returns edges containing the bipartite edge values.
*
- * Note: KT must override .equals(). This requirement may be removed in a future release.
+ * <p>Note: KT must override .equals(). This requirement may be removed in a future release.
*
* @return simple top projection of the bipartite graph
*/
@@ -162,9 +162,9 @@ public class BipartiteGraph<KT, KB, VVT, VVB, EV> {
* vertices in the new graph will exist only if the original bipartite graph contains a top vertex they are both
* connected to.
*
- * The simple projection performs a single join and returns edges containing the bipartite edge values.
+ * <p>The simple projection performs a single join and returns edges containing the bipartite edge values.
*
- * Note: KB must override .equals(). This requirement may be removed in a future release.
+ * <p>Note: KB must override .equals(). This requirement may be removed in a future release.
*
* @return simple bottom projection of the bipartite graph
*/
@@ -205,10 +205,10 @@ public class BipartiteGraph<KT, KB, VVT, VVB, EV> {
* Convert a bipartite graph into a graph that contains only top vertices. An edge between two vertices in the new
* graph will exist only if the original bipartite graph contains at least one bottom vertex they both connect to.
*
- * The full projection performs three joins and returns edges containing the the connecting vertex ID and value,
+ * <p>The full projection performs three joins and returns edges containing the the connecting vertex ID and value,
* both top vertex values, and both bipartite edge values.
*
- * Note: KT must override .equals(). This requirement may be removed in a future release.
+ * <p>Note: KT must override .equals(). This requirement may be removed in a future release.
*
* @return full top projection of the bipartite graph
*/
@@ -271,10 +271,10 @@ public class BipartiteGraph<KT, KB, VVT, VVB, EV> {
* Convert a bipartite graph into a graph that contains only bottom vertices. An edge between two vertices in the
* new graph will exist only if the original bipartite graph contains at least one top vertex they both connect to.
*
- * The full projection performs three joins and returns edges containing the the connecting vertex ID and value,
+ * <p>The full projection performs three joins and returns edges containing the the connecting vertex ID and value,
* both bottom vertex values, and both bipartite edge values.
*
- * Note: KB must override .equals(). This requirement may be removed in a future release.
+ * <p>Note: KB must override .equals(). This requirement may be removed in a future release.
*
* @return full bottom projection of the bipartite graph
*/
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/bipartite/Projection.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/bipartite/Projection.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/bipartite/Projection.java
index 95a9cf6..ffb3462 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/bipartite/Projection.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/bipartite/Projection.java
@@ -22,7 +22,7 @@ import org.apache.flink.api.java.tuple.Tuple6;
import org.apache.flink.graph.Vertex;
/**
- * The edge value of a full bipartite projection contains:
+ * The edge value of a full bipartite projection. This contains:
* <ul>
* <li>the ID and vertex value of the connecting vertex</li>
* <li>the vertex value for the source and target vertex</li>
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/AbstractGraphGenerator.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/AbstractGraphGenerator.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/AbstractGraphGenerator.java
deleted file mode 100644
index 58266a5..0000000
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/AbstractGraphGenerator.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.flink.graph.generator;
-
-import static org.apache.flink.api.common.ExecutionConfig.PARALLELISM_DEFAULT;
-
-public abstract class AbstractGraphGenerator<K, VV, EV>
-implements GraphGenerator<K, VV, EV> {
-
- // Optional configuration
- protected int parallelism = PARALLELISM_DEFAULT;
-
- @Override
- public GraphGenerator<K, VV, EV> setParallelism(int parallelism) {
- this.parallelism = parallelism;
-
- return this;
- }
-}
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/CirculantGraph.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/CirculantGraph.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/CirculantGraph.java
index 9569b74..1dc9e66 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/CirculantGraph.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/CirculantGraph.java
@@ -41,7 +41,7 @@ import java.util.List;
* @see <a href="http://mathworld.wolfram.com/CirculantGraph.html">Circulant Graph at Wolfram MathWorld</a>
*/
public class CirculantGraph
-extends AbstractGraphGenerator<LongValue, NullValue, NullValue> {
+extends GraphGeneratorBase<LongValue, NullValue, NullValue> {
public static final int MINIMUM_VERTEX_COUNT = 2;
@@ -178,7 +178,7 @@ extends AbstractGraphGenerator<LongValue, NullValue, NullValue> {
}
/**
- * Get the range offset
+ * Get the range offset.
*
* @return the offset
*/
@@ -187,7 +187,7 @@ extends AbstractGraphGenerator<LongValue, NullValue, NullValue> {
}
/**
- * Get the range length
+ * Get the range length.
*
* @return the length
*/
@@ -196,7 +196,7 @@ extends AbstractGraphGenerator<LongValue, NullValue, NullValue> {
}
/**
- * Get the offset of the last index in the range
+ * Get the offset of the last index in the range.
*
* @return last offset
*/
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/CompleteGraph.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/CompleteGraph.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/CompleteGraph.java
index 9dabe56..bf7dedf 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/CompleteGraph.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/CompleteGraph.java
@@ -28,7 +28,7 @@ import org.apache.flink.util.Preconditions;
* @see <a href="http://mathworld.wolfram.com/CompleteGraph.html">Complete Graph at Wolfram MathWorld</a>
*/
public class CompleteGraph
-extends AbstractGraphGenerator<LongValue, NullValue, NullValue> {
+extends GraphGeneratorBase<LongValue, NullValue, NullValue> {
public static final int MINIMUM_VERTEX_COUNT = 2;
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/CycleGraph.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/CycleGraph.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/CycleGraph.java
index 2386fe8..5b61fa8 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/CycleGraph.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/CycleGraph.java
@@ -28,7 +28,7 @@ import org.apache.flink.util.Preconditions;
* @see <a href="http://mathworld.wolfram.com/CycleGraph.html">Cycle Graph at Wolfram MathWorld</a>
*/
public class CycleGraph
-extends AbstractGraphGenerator<LongValue, NullValue, NullValue> {
+extends GraphGeneratorBase<LongValue, NullValue, NullValue> {
public static final int MINIMUM_VERTEX_COUNT = 2;
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/EchoGraph.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/EchoGraph.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/EchoGraph.java
index c15cdca..d834df1 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/EchoGraph.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/EchoGraph.java
@@ -30,13 +30,13 @@ import org.apache.flink.util.Preconditions;
* single range of offsets centered at {@code n/2}. A vertex is connected to
* 'far' vertices, which connect to 'near' vertices, which connect to 'far'
* vertices, ....
- * <p>
- * Every {@link Vertex} in the {@link EchoGraph} has the same degree.
+ *
+ * <p>Every {@link Vertex} in the {@link EchoGraph} has the same degree.
* and vertices as far as possible are chose to be linked.
* {@link EchoGraph} is a specific case of {@link CirculantGraph}.
*/
public class EchoGraph
-extends AbstractGraphGenerator<LongValue, NullValue, NullValue> {
+extends GraphGeneratorBase<LongValue, NullValue, NullValue> {
public static final int MINIMUM_VERTEX_COUNT = 2;
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/EmptyGraph.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/EmptyGraph.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/EmptyGraph.java
index 23e3a9c..466e2d3 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/EmptyGraph.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/EmptyGraph.java
@@ -37,7 +37,7 @@ import java.util.Collections;
* @see <a href="http://mathworld.wolfram.com/EmptyGraph.html">Empty Graph at Wolfram MathWorld</a>
*/
public class EmptyGraph
-extends AbstractGraphGenerator<LongValue, NullValue, NullValue> {
+extends GraphGeneratorBase<LongValue, NullValue, NullValue> {
public static final int MINIMUM_VERTEX_COUNT = 1;
@@ -71,7 +71,7 @@ extends AbstractGraphGenerator<LongValue, NullValue, NullValue> {
ValueTypeInfo.LONG_VALUE_TYPE_INFO, ValueTypeInfo.LONG_VALUE_TYPE_INFO, ValueTypeInfo.NULL_VALUE_TYPE_INFO);
DataSource<Edge<LongValue, NullValue>> edges = env
- .fromCollection(Collections.<Edge<LongValue ,NullValue>>emptyList(), typeInformation)
+ .fromCollection(Collections.<Edge<LongValue, NullValue>>emptyList(), typeInformation)
.setParallelism(parallelism)
.name("Empty edge set");
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/GraphGenerator.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/GraphGenerator.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/GraphGenerator.java
index f972d98..24737810 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/GraphGenerator.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/GraphGenerator.java
@@ -26,11 +26,11 @@ import org.apache.flink.graph.Graph;
* - scale-free, generating the same graph regardless of parallelism
* - thrifty, using as few operators as possible
*
- * Graph generators should prefer to emit edges sorted by the source label.
+ * <p>Graph generators should prefer to emit edges sorted by the source label.
*
- * @param <K> the key type for edge and vertex identifiers
- * @param <VV> the value type for vertices
- * @param <EV> the value type for edges
+ * @param <K> graph ID type
+ * @param <VV> vertex value type
+ * @param <EV> edge value type
*/
public interface GraphGenerator<K, VV, EV> {
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/GraphGeneratorBase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/GraphGeneratorBase.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/GraphGeneratorBase.java
new file mode 100644
index 0000000..1c4d097
--- /dev/null
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/GraphGeneratorBase.java
@@ -0,0 +1,42 @@
+/*
+ * 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.
+ */
+
+package org.apache.flink.graph.generator;
+
+import static org.apache.flink.api.common.ExecutionConfig.PARALLELISM_DEFAULT;
+
+/**
+ * Base class for graph generators.
+ *
+ * @param <K> graph ID type
+ * @param <VV> vertex value type
+ * @param <EV> edge value type
+ */
+public abstract class GraphGeneratorBase<K, VV, EV>
+implements GraphGenerator<K, VV, EV> {
+
+ // Optional configuration
+ protected int parallelism = PARALLELISM_DEFAULT;
+
+ @Override
+ public GraphGenerator<K, VV, EV> setParallelism(int parallelism) {
+ this.parallelism = parallelism;
+
+ return this;
+ }
+}
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/GraphGeneratorUtils.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/GraphGeneratorUtils.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/GraphGeneratorUtils.java
index 485394c..fca9d8b 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/GraphGeneratorUtils.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/GraphGeneratorUtils.java
@@ -32,8 +32,13 @@ import org.apache.flink.types.NullValue;
import org.apache.flink.util.Collector;
import org.apache.flink.util.LongValueSequenceIterator;
+/**
+ * Utilities for graph generators.
+ */
public class GraphGeneratorUtils {
+ private GraphGeneratorUtils() {}
+
/**
* Generates {@link Vertex Vertices} with sequential, numerical labels.
*
@@ -43,7 +48,7 @@ public class GraphGeneratorUtils {
* @return {@link DataSet} of sequentially labeled {@link Vertex Vertices}
*/
public static DataSet<Vertex<LongValue, NullValue>> vertexSequence(ExecutionEnvironment env, int parallelism, long vertexCount) {
- LongValueSequenceIterator iterator = new LongValueSequenceIterator(0, vertexCount-1);
+ LongValueSequenceIterator iterator = new LongValueSequenceIterator(0, vertexCount - 1);
DataSource<LongValue> vertexLabels = env
.fromParallelCollection(iterator, LongValue.class)
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/GridGraph.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/GridGraph.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/GridGraph.java
index 0570dd2..cae2bc4 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/GridGraph.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/GridGraph.java
@@ -39,7 +39,7 @@ import java.util.List;
* @see <a href="http://mathworld.wolfram.com/GridGraph.html">Grid Graph at Wolfram MathWorld</a>
*/
public class GridGraph
-extends AbstractGraphGenerator<LongValue, NullValue, NullValue> {
+extends GraphGeneratorBase<LongValue, NullValue, NullValue> {
// Required to create the DataSource
private final ExecutionEnvironment env;
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/HypercubeGraph.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/HypercubeGraph.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/HypercubeGraph.java
index e4eac69..daaaf53 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/HypercubeGraph.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/HypercubeGraph.java
@@ -28,7 +28,7 @@ import org.apache.flink.util.Preconditions;
* @see <a href="http://mathworld.wolfram.com/HypercubeGraph.html">Hypercube Graph at Wolfram MathWorld</a>
*/
public class HypercubeGraph
-extends AbstractGraphGenerator<LongValue, NullValue, NullValue> {
+extends GraphGeneratorBase<LongValue, NullValue, NullValue> {
public static final int MINIMUM_DIMENSIONS = 1;
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/PathGraph.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/PathGraph.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/PathGraph.java
index 5c4343b..e61fcd8 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/PathGraph.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/PathGraph.java
@@ -28,7 +28,7 @@ import org.apache.flink.util.Preconditions;
* @see <a href="http://mathworld.wolfram.com/PathGraph.html">Path Graph at Wolfram MathWorld</a>
*/
public class PathGraph
-extends AbstractGraphGenerator<LongValue, NullValue, NullValue> {
+extends GraphGeneratorBase<LongValue, NullValue, NullValue> {
public static final int MINIMUM_VERTEX_COUNT = 2;
@@ -42,8 +42,8 @@ extends AbstractGraphGenerator<LongValue, NullValue, NullValue> {
* An undirected {@link Graph} with {@code n} vertices where each vertex
* v<sub>i</sub> connects to adjacent vertices v<sub>i+1</sub> when
* {@code i < n-1} and v<sub>i-1</sub> when {@code i > 0}.
- * <p>
- * A {@code PathGraph} is distinguished from a {@code CycleGraph} in that
+ *
+ * <p>A {@code PathGraph} is distinguished from a {@code CycleGraph} in that
* the first and last vertex are not connected, breaking the cycle.
*
* @param env the Flink execution environment
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/RMatGraph.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/RMatGraph.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/RMatGraph.java
index 071b415..d14d32c 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/RMatGraph.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/RMatGraph.java
@@ -18,7 +18,6 @@
package org.apache.flink.graph.generator;
-import org.apache.commons.math3.random.RandomGenerator;
import org.apache.flink.api.common.functions.FlatMapFunction;
import org.apache.flink.api.java.DataSet;
import org.apache.flink.api.java.ExecutionEnvironment;
@@ -32,13 +31,15 @@ import org.apache.flink.types.NullValue;
import org.apache.flink.util.Collector;
import org.apache.flink.util.Preconditions;
+import org.apache.commons.math3.random.RandomGenerator;
+
import java.util.List;
/**
* @see <a href="http://www.cs.cmu.edu/~christos/PUBLICATIONS/siam04.pdf">R-MAT: A Recursive Model for Graph Mining</a>
*/
public class RMatGraph<T extends RandomGenerator>
-extends AbstractGraphGenerator<LongValue, NullValue, NullValue> {
+extends GraphGeneratorBase<LongValue, NullValue, NullValue> {
public static final int MINIMUM_VERTEX_COUNT = 1;
@@ -64,15 +65,15 @@ extends AbstractGraphGenerator<LongValue, NullValue, NullValue> {
private final long edgeCount;
// Optional configuration
- public float A = DEFAULT_A;
+ private float a = DEFAULT_A;
- public float B = DEFAULT_B;
+ private float b = DEFAULT_B;
- public float C = DEFAULT_C;
+ private float c = DEFAULT_C;
private boolean noiseEnabled = false;
- public float noise = DEFAULT_NOISE;
+ private float noise = DEFAULT_NOISE;
/**
* A directed power-law multi{@link Graph graph} generated using the
@@ -99,22 +100,22 @@ extends AbstractGraphGenerator<LongValue, NullValue, NullValue> {
/**
* The parameters for recursively subdividing the adjacency matrix.
*
- * Setting A = B = C = 0.25 emulates the Erdős–Rényi model.
+ * <p>Setting A = B = C = 0.25 emulates the Erdős–Rényi model.
*
- * Graph500 uses A = 0.57, B = C = 0.19.
+ * <p>Graph500 uses A = 0.57, B = C = 0.19.
*
- * @param A likelihood of source bit = 0, target bit = 0
- * @param B likelihood of source bit = 0, target bit = 1
- * @param C likelihood of source bit = 1, target bit = 0
+ * @param a likelihood of source bit = 0, target bit = 0
+ * @param b likelihood of source bit = 0, target bit = 1
+ * @param c likelihood of source bit = 1, target bit = 0
* @return this
*/
- public RMatGraph<T> setConstants(float A, float B, float C) {
- Preconditions.checkArgument(A >= 0.0f && B >= 0.0f && C >= 0.0f && A + B + C <= 1.0f,
+ public RMatGraph<T> setConstants(float a, float b, float c) {
+ Preconditions.checkArgument(a >= 0.0f && b >= 0.0f && c >= 0.0f && a + b + c <= 1.0f,
"RMat parameters A, B, and C must be non-negative and sum to less than or equal to one");
- this.A = A;
- this.B = B;
- this.C = C;
+ this.a = a;
+ this.b = b;
+ this.c = c;
return this;
}
@@ -155,7 +156,7 @@ extends AbstractGraphGenerator<LongValue, NullValue, NullValue> {
.rebalance()
.setParallelism(parallelism)
.name("Rebalance")
- .flatMap(new GenerateEdges<T>(vertexCount, scale, A, B, C, noiseEnabled, noise))
+ .flatMap(new GenerateEdges<T>(vertexCount, scale, a, b, c, noiseEnabled, noise))
.setParallelism(parallelism)
.name("RMat graph edges");
@@ -174,13 +175,13 @@ extends AbstractGraphGenerator<LongValue, NullValue, NullValue> {
private final int scale;
- private final float A;
+ private final float a;
- private final float B;
+ private final float b;
- private final float C;
+ private final float c;
- private final float D;
+ private final float d;
private final boolean noiseEnabled;
@@ -195,13 +196,13 @@ extends AbstractGraphGenerator<LongValue, NullValue, NullValue> {
private Edge<LongValue, NullValue> targetToSource = new Edge<>(target, source, NullValue.getInstance());
- public GenerateEdges(long vertexCount, int scale, float A, float B, float C, boolean noiseEnabled, float noise) {
+ public GenerateEdges(long vertexCount, int scale, float a, float b, float c, boolean noiseEnabled, float noise) {
this.vertexCount = vertexCount;
this.scale = scale;
- this.A = A;
- this.B = B;
- this.C = C;
- this.D = 1.0f - A - B - C;
+ this.a = a;
+ this.b = b;
+ this.c = c;
+ this.d = 1.0f - a - b - c;
this.noiseEnabled = noiseEnabled;
this.noise = noise;
}
@@ -217,10 +218,10 @@ extends AbstractGraphGenerator<LongValue, NullValue, NullValue> {
long y = 0;
// matrix constants are reset for each edge
- float a = A;
- float b = B;
- float c = C;
- float d = D;
+ float a = this.a;
+ float b = this.b;
+ float c = this.c;
+ float d = this.d;
for (int bit = 0; bit < scale; bit++) {
// generated next bit for source and target
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/SingletonEdgeGraph.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/SingletonEdgeGraph.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/SingletonEdgeGraph.java
index 125501c..159e55d 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/SingletonEdgeGraph.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/SingletonEdgeGraph.java
@@ -34,7 +34,7 @@ import org.apache.flink.util.Preconditions;
* A singleton-edge {@link Graph} contains one or more isolated two-paths.
*/
public class SingletonEdgeGraph
-extends AbstractGraphGenerator<LongValue, NullValue, NullValue> {
+extends GraphGeneratorBase<LongValue, NullValue, NullValue> {
public static final int MINIMUM_VERTEX_PAIR_COUNT = 1;
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/StarGraph.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/StarGraph.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/StarGraph.java
index f0f4e5a..7133320 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/StarGraph.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/StarGraph.java
@@ -35,7 +35,7 @@ import org.apache.flink.util.Preconditions;
* @see <a href="http://mathworld.wolfram.com/StarGraph.html">Star Graph at Wolfram MathWorld</a>
*/
public class StarGraph
-extends AbstractGraphGenerator<LongValue, NullValue, NullValue> {
+extends GraphGeneratorBase<LongValue, NullValue, NullValue> {
public static final int MINIMUM_VERTEX_COUNT = 2;
@@ -87,18 +87,18 @@ extends AbstractGraphGenerator<LongValue, NullValue, NullValue> {
private LongValue center = new LongValue(0);
- private Edge<LongValue, NullValue> center_to_leaf = new Edge<>(center, null, NullValue.getInstance());
+ private Edge<LongValue, NullValue> centerToLeaf = new Edge<>(center, null, NullValue.getInstance());
- private Edge<LongValue, NullValue> leaf_to_center = new Edge<>(null, center, NullValue.getInstance());
+ private Edge<LongValue, NullValue> leafToCenter = new Edge<>(null, center, NullValue.getInstance());
@Override
public void flatMap(LongValue leaf, Collector<Edge<LongValue, NullValue>> out)
throws Exception {
- center_to_leaf.f1 = leaf;
- out.collect(center_to_leaf);
+ centerToLeaf.f1 = leaf;
+ out.collect(centerToLeaf);
- leaf_to_center.f0 = leaf;
- out.collect(leaf_to_center);
+ leafToCenter.f0 = leaf;
+ out.collect(leafToCenter);
}
}
}
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/random/AbstractGeneratorFactory.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/random/AbstractGeneratorFactory.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/random/AbstractGeneratorFactory.java
deleted file mode 100644
index fc9e1ba..0000000
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/random/AbstractGeneratorFactory.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.flink.graph.generator.random;
-
-import org.apache.commons.math3.random.RandomGenerator;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * This base class handles the task of dividing the requested work into the
- * appropriate number of blocks of near-equal size.
- *
- * @param <T> the type of the {@code RandomGenerator}
- */
-public abstract class AbstractGeneratorFactory<T extends RandomGenerator>
-implements RandomGenerableFactory<T> {
-
- // A large computation will run in parallel but blocks are generated on
- // and distributed from a single node. This limit should be greater
- // than the maximum expected parallelism.
- public static final int MAXIMUM_BLOCK_COUNT = 1 << 15;
-
- // This should be sufficiently large relative to the cost of instantiating
- // and initializing the random generator and sufficiently small relative to
- // the cost of generating random values.
- protected abstract int getMinimumCyclesPerBlock();
-
- protected abstract RandomGenerable<T> next();
-
- @Override
- public List<BlockInfo<T>> getRandomGenerables(long elementCount, int cyclesPerElement) {
- long cycles = elementCount * cyclesPerElement;
- int blockCount = Math.min((int) Math.ceil(cycles / (float) getMinimumCyclesPerBlock()), MAXIMUM_BLOCK_COUNT);
-
- long elementsPerBlock = elementCount / blockCount;
- long elementRemainder = elementCount % blockCount;
-
- List<BlockInfo<T>> blocks = new ArrayList<>(blockCount);
- long blockStart = 0;
-
- for (int blockIndex = 0 ; blockIndex < blockCount ; blockIndex++) {
- if (blockIndex == blockCount - elementRemainder) {
- elementsPerBlock++;
- }
-
- RandomGenerable<T> randomGenerable = next();
-
- blocks.add(new BlockInfo<>(randomGenerable, blockIndex, blockCount, blockStart, elementsPerBlock));
-
- blockStart += elementsPerBlock;
- }
-
- return blocks;
- }
-}
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/random/GeneratorFactoryBase.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/random/GeneratorFactoryBase.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/random/GeneratorFactoryBase.java
new file mode 100644
index 0000000..d3147aa
--- /dev/null
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/random/GeneratorFactoryBase.java
@@ -0,0 +1,72 @@
+/*
+ * 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.
+ */
+
+package org.apache.flink.graph.generator.random;
+
+import org.apache.commons.math3.random.RandomGenerator;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * This base class handles the task of dividing the requested work into the
+ * appropriate number of blocks of near-equal size.
+ *
+ * @param <T> the type of the {@code RandomGenerator}
+ */
+public abstract class GeneratorFactoryBase<T extends RandomGenerator>
+implements RandomGenerableFactory<T> {
+
+ // A large computation will run in parallel but blocks are generated on
+ // and distributed from a single node. This limit should be greater
+ // than the maximum expected parallelism.
+ public static final int MAXIMUM_BLOCK_COUNT = 1 << 15;
+
+ // This should be sufficiently large relative to the cost of instantiating
+ // and initializing the random generator and sufficiently small relative to
+ // the cost of generating random values.
+ protected abstract int getMinimumCyclesPerBlock();
+
+ protected abstract RandomGenerable<T> next();
+
+ @Override
+ public List<BlockInfo<T>> getRandomGenerables(long elementCount, int cyclesPerElement) {
+ long cycles = elementCount * cyclesPerElement;
+ int blockCount = Math.min((int) Math.ceil(cycles / (float) getMinimumCyclesPerBlock()), MAXIMUM_BLOCK_COUNT);
+
+ long elementsPerBlock = elementCount / blockCount;
+ long elementRemainder = elementCount % blockCount;
+
+ List<BlockInfo<T>> blocks = new ArrayList<>(blockCount);
+ long blockStart = 0;
+
+ for (int blockIndex = 0; blockIndex < blockCount; blockIndex++) {
+ if (blockIndex == blockCount - elementRemainder) {
+ elementsPerBlock++;
+ }
+
+ RandomGenerable<T> randomGenerable = next();
+
+ blocks.add(new BlockInfo<>(randomGenerable, blockIndex, blockCount, blockStart, elementsPerBlock));
+
+ blockStart += elementsPerBlock;
+ }
+
+ return blocks;
+ }
+}
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/random/JDKRandomGeneratorFactory.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/random/JDKRandomGeneratorFactory.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/random/JDKRandomGeneratorFactory.java
index 2024cae..d406150 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/random/JDKRandomGeneratorFactory.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/random/JDKRandomGeneratorFactory.java
@@ -25,7 +25,7 @@ import org.apache.commons.math3.random.JDKRandomGenerator;
* distributed collection of {@link JDKRandomGenerator}.
*/
public class JDKRandomGeneratorFactory
-extends AbstractGeneratorFactory<JDKRandomGenerator> {
+extends GeneratorFactoryBase<JDKRandomGenerator> {
public static final long DEFAULT_SEED = 0x4b6f7e18198de7a4L;
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/random/MersenneTwisterFactory.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/random/MersenneTwisterFactory.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/random/MersenneTwisterFactory.java
index 22a7b04..5dd5a31 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/random/MersenneTwisterFactory.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/random/MersenneTwisterFactory.java
@@ -25,7 +25,7 @@ import org.apache.commons.math3.random.MersenneTwister;
* distributed collection of {@link MersenneTwister}.
*/
public class MersenneTwisterFactory
-extends AbstractGeneratorFactory<MersenneTwister> {
+extends GeneratorFactoryBase<MersenneTwister> {
public static final long DEFAULT_SEED = 0x74c8cc8a58a9ceb9L;
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/random/RandomGenerable.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/random/RandomGenerable.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/random/RandomGenerable.java
index 318b508..122d479 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/random/RandomGenerable.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/generator/random/RandomGenerable.java
@@ -25,7 +25,7 @@ import org.apache.commons.math3.random.RandomGenerator;
* RandomGenerator. This allows pre-processing or discovery to be distributed
* and performed in parallel by Flink tasks.
*
- * A distributed PRNG is described by Matsumoto and Takuji in
+ * <p>A distributed PRNG is described by Matsumoto and Takuji in
* "Dynamic Creation of Pseudorandom Number Generators".
*
* @param <T> the type of the {@code RandomGenerator}
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/gsa/ApplyFunction.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/gsa/ApplyFunction.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/gsa/ApplyFunction.java
index 19d08a5..4222f8a 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/gsa/ApplyFunction.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/gsa/ApplyFunction.java
@@ -59,17 +59,17 @@ public abstract class ApplyFunction<K, VV, M> implements Serializable {
//---------------------------------------------------------------------------------------------
/**
- * This method is invoked once per superstep, after the {@link SumFunction}
+ * This method is invoked once per superstep, after the {@link SumFunction}
* in a {@link GatherSumApplyIteration}.
* It updates the Vertex values.
- *
+ *
* @param newValue the value computed during the current superstep.
* @param currentValue the current Vertex value.
*/
public abstract void apply(M newValue, VV currentValue);
/**
- * Sets the result for the apply function
+ * Sets the result for the apply function.
*
* @param result the result of the apply phase
*/
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/gsa/GSAConfiguration.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/gsa/GSAConfiguration.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/gsa/GSAConfiguration.java
index 079b4c7..72e18ae 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/gsa/GSAConfiguration.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/gsa/GSAConfiguration.java
@@ -32,19 +32,19 @@ import java.util.List;
* the {@link org.apache.flink.graph.gsa.GatherFunction}, {@link org.apache.flink.graph.gsa.SumFunction} as well as
* {@link org.apache.flink.graph.gsa.ApplyFunction}.
*
- * The GSAConfiguration object is passed as an argument to
+ * <p>The GSAConfiguration object is passed as an argument to
* {@link org.apache.flink.graph.Graph#runGatherSumApplyIteration(org.apache.flink.graph.gsa.GatherFunction,
* org.apache.flink.graph.gsa.SumFunction, org.apache.flink.graph.gsa.ApplyFunction, int)}
*/
public class GSAConfiguration extends IterationConfiguration {
- /** the broadcast variables for the gather function **/
+ // the broadcast variables for the gather function
private List<Tuple2<String, DataSet<?>>> bcVarsGather = new ArrayList<>();
- /** the broadcast variables for the sum function **/
+ // the broadcast variables for the sum function
private List<Tuple2<String, DataSet<?>>> bcVarsSum = new ArrayList<>();
- /** the broadcast variables for the apply function **/
+ // the broadcast variables for the apply function
private List<Tuple2<String, DataSet<?>>> bcVarsApply = new ArrayList<>();
private EdgeDirection direction = EdgeDirection.OUT;
@@ -113,7 +113,7 @@ public class GSAConfiguration extends IterationConfiguration {
/**
* Gets the direction from which the neighbors are to be selected
- * By default the neighbors who are target of the edges are selected
+ * By default the neighbors who are target of the edges are selected.
*
* @return an EdgeDirection, which can be either IN, OUT or ALL.
*/
@@ -123,7 +123,7 @@ public class GSAConfiguration extends IterationConfiguration {
/**
* Sets the direction in which neighbors are to be selected
- * By default the neighbors who are target of the edges are selected
+ * By default the neighbors who are target of the edges are selected.
*
* @param direction - IN, OUT or ALL
*/
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/gsa/GatherFunction.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/gsa/GatherFunction.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/gsa/GatherFunction.java
index 90db9da..76e4cee 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/gsa/GatherFunction.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/gsa/GatherFunction.java
@@ -27,10 +27,10 @@ import java.util.Collection;
/**
* The base class for the first step of a {@link GatherSumApplyIteration}.
- *
+ *
* @param <VV> the vertex value type
* @param <EV> the edge value type
- * @param <M> the output type
+ * @param <M> the output type
*/
@SuppressWarnings("serial")
public abstract class GatherFunction<VV, EV, M> implements Serializable {
@@ -57,11 +57,11 @@ public abstract class GatherFunction<VV, EV, M> implements Serializable {
//---------------------------------------------------------------------------------------------
/**
- * This method is invoked once per superstep, for each {@link Neighbor} of each Vertex
+ * This method is invoked once per superstep, for each {@link Neighbor} of each Vertex
* in the beginning of each superstep in a {@link GatherSumApplyIteration}.
* It needs to produce a partial value, which will be combined with other partial value
* in the next phase of the iteration.
- *
+ *
* @param neighbor the input Neighbor. It provides access to the source Vertex and the Edge objects.
* @return a partial result to be combined in the Sum phase.
*/
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/gsa/GatherSumApplyIteration.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/gsa/GatherSumApplyIteration.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/gsa/GatherSumApplyIteration.java
index 5c07a73..12d4977 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/gsa/GatherSumApplyIteration.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/gsa/GatherSumApplyIteration.java
@@ -105,7 +105,7 @@ public class GatherSumApplyIteration<K, VV, EV, M> implements CustomUnaryOperati
}
/**
- * Computes the results of the gather-sum-apply iteration
+ * Computes the results of the gather-sum-apply iteration.
*
* @return The resulting DataSet
*/
@@ -161,7 +161,7 @@ public class GatherSumApplyIteration<K, VV, EV, M> implements CustomUnaryOperati
}
// Prepare the neighbors
- if(this.configuration != null) {
+ if (this.configuration != null) {
direction = this.configuration.getDirection();
}
DataSet<Tuple2<K, Neighbor<VV, EV>>> neighbors;
@@ -246,7 +246,7 @@ public class GatherSumApplyIteration<K, VV, EV, M> implements CustomUnaryOperati
}
/**
- * Creates a new gather-sum-apply iteration operator for graphs
+ * Creates a new gather-sum-apply iteration operator for graphs.
*
* @param edges The edge DataSet
*
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/gsa/Neighbor.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/gsa/Neighbor.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/gsa/Neighbor.java
index 4c970fb..c69c7f7 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/gsa/Neighbor.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/gsa/Neighbor.java
@@ -21,8 +21,9 @@ package org.apache.flink.graph.gsa;
import org.apache.flink.api.java.tuple.Tuple2;
/**
- * This class represents a {@code <sourceVertex, edge>} pair
- * This is a wrapper around {@code Tuple2<VV, EV>} for convenience in the GatherFunction
+ * This class represents a {@code <sourceVertex, edge>} pair. This is a wrapper
+ * around {@code Tuple2<VV, EV>} for convenience in the GatherFunction.
+ *
* @param <VV> the vertex value type
* @param <EV> the edge value type
*/
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/gsa/SumFunction.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/gsa/SumFunction.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/gsa/SumFunction.java
index e70af1f..0d60c87 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/gsa/SumFunction.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/gsa/SumFunction.java
@@ -56,11 +56,11 @@ public abstract class SumFunction<VV, EV, M> implements Serializable {
//---------------------------------------------------------------------------------------------
/**
- * This method is invoked once per superstep, after the {@link GatherFunction}
+ * This method is invoked once per superstep, after the {@link GatherFunction}
* in a {@link GatherSumApplyIteration}.
* It combines the partial values produced by {@link GatherFunction#gather(Neighbor)}
* in pairs, until a single value has been computed.
- *
+ *
* @param arg0 the first partial value.
* @param arg1 the second partial value.
* @return the combined value.
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/CommunityDetection.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/CommunityDetection.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/CommunityDetection.java
index 74fdd69..9846286 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/CommunityDetection.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/CommunityDetection.java
@@ -36,14 +36,14 @@ import java.util.TreeMap;
/**
* Community Detection Algorithm.
*
- * The Vertex values of the input Graph provide the initial label assignments.
- *
- * Initially, each vertex is assigned a tuple formed of its own initial value along with a score equal to 1.0.
+ * <p>The Vertex values of the input Graph provide the initial label assignments.
+ *
+ * <p>Initially, each vertex is assigned a tuple formed of its own initial value along with a score equal to 1.0.
* The vertices propagate their labels and max scores in iterations, each time adopting the label with the
* highest score from the list of received messages. The chosen label is afterwards re-scored using the fraction
* delta/the superstep number. Delta is passed as a parameter and has 0.5 as a default value.
- *
- * @param <K> the Vertex ID type
+ *
+ * @param <K> the Vertex ID type
*
*/
public class CommunityDetection<K> implements GraphAlgorithm<K, Long, Double, Graph<K, Long, Double>> {
@@ -56,12 +56,12 @@ public class CommunityDetection<K> implements GraphAlgorithm<K, Long, Double, Gr
* Creates a new Community Detection algorithm instance.
* The algorithm converges when vertices no longer update their value
* or when the maximum number of iterations is reached.
- *
+ *
* @see <a href="http://arxiv.org/pdf/0808.2633.pdf">
* Towards real-time community detection in large networks</a>
- *
+ *
* @param maxIterations The maximum number of iterations to run.
- * @param delta The hop attenuation parameter. Its default value is 0.5.
+ * @param delta The hop attenuation parameter. Its default value is 0.5.
*/
public CommunityDetection(int maxIterations, double delta) {
@@ -84,13 +84,13 @@ public class CommunityDetection<K> implements GraphAlgorithm<K, Long, Double, Gr
}
@SuppressWarnings("serial")
- public static final class LabelMessenger<K> extends ScatterFunction<K, Tuple2<Long, Double>,
+ private static final class LabelMessenger<K> extends ScatterFunction<K, Tuple2<Long, Double>,
Tuple2<Long, Double>, Double> {
@Override
public void sendMessages(Vertex<K, Tuple2<Long, Double>> vertex) throws Exception {
- for(Edge<K, Double> edge : getEdges()) {
+ for (Edge<K, Double> edge : getEdges()) {
sendMessageTo(edge.getTarget(), new Tuple2<>(vertex.getValue().f0,
vertex.getValue().f1 * edge.getValue()));
}
@@ -98,7 +98,7 @@ public class CommunityDetection<K> implements GraphAlgorithm<K, Long, Double, Gr
}
@SuppressWarnings("serial")
- public static final class VertexLabelUpdater<K> extends GatherFunction<
+ private static final class VertexLabelUpdater<K> extends GatherFunction<
K, Tuple2<Long, Double>, Tuple2<Long, Double>> {
private double delta;
@@ -142,7 +142,7 @@ public class CommunityDetection<K> implements GraphAlgorithm<K, Long, Double, Gr
}
}
- if(receivedLabelsWithScores.size() > 0) {
+ if (receivedLabelsWithScores.size() > 0) {
// find the label with the highest score from the ones received
double maxScore = Double.MIN_VALUE;
long maxScoreLabel = vertex.getValue().f0;
@@ -169,7 +169,7 @@ public class CommunityDetection<K> implements GraphAlgorithm<K, Long, Double, Gr
@SuppressWarnings("serial")
@ForwardedFields("f0")
- public static final class AddScoreToVertexValuesMapper<K> implements MapFunction<
+ private static final class AddScoreToVertexValuesMapper<K> implements MapFunction<
Vertex<K, Long>, Vertex<K, Tuple2<Long, Double>>> {
public Vertex<K, Tuple2<Long, Double>> map(Vertex<K, Long> vertex) {
@@ -178,7 +178,7 @@ public class CommunityDetection<K> implements GraphAlgorithm<K, Long, Double, Gr
}
@SuppressWarnings("serial")
- public static final class RemoveScoreFromVertexValuesMapper<K> implements MapFunction<
+ private static final class RemoveScoreFromVertexValuesMapper<K> implements MapFunction<
Vertex<K, Tuple2<Long, Double>>, Long> {
@Override
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/ConnectedComponents.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/ConnectedComponents.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/ConnectedComponents.java
index 959b816..a3110ab 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/ConnectedComponents.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/ConnectedComponents.java
@@ -35,17 +35,17 @@ import org.apache.flink.types.NullValue;
/**
* A scatter-gather implementation of the Weakly Connected Components algorithm.
*
- * This implementation uses a comparable vertex value as initial component
+ * <p>This implementation uses a comparable vertex value as initial component
* identifier (ID). Vertices propagate their current value in each iteration.
* Upon receiving component IDs from its neighbors, a vertex adopts a new
* component ID if its value is lower than its current component ID.
*
- * The algorithm converges when vertices no longer update their component ID
+ * <p>The algorithm converges when vertices no longer update their component ID
* value or when the maximum number of iterations has been reached.
- *
- * The result is a DataSet of vertices, where the vertex value corresponds to
+ *
+ * <p>The result is a DataSet of vertices, where the vertex value corresponds to
* the assigned component ID.
- *
+ *
* @see GSAConnectedComponents
*/
@SuppressWarnings("serial")
@@ -59,7 +59,7 @@ public class ConnectedComponents<K, VV extends Comparable<VV>, EV>
* The algorithm computes weakly connected components
* and converges when no vertex updates its component ID
* or when the maximum number of iterations has been reached.
- *
+ *
* @param maxIterations The maximum number of iterations to run.
*/
public ConnectedComponents(Integer maxIterations) {
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/GSAConnectedComponents.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/GSAConnectedComponents.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/GSAConnectedComponents.java
index 1680f38..37e5cab 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/GSAConnectedComponents.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/GSAConnectedComponents.java
@@ -36,18 +36,18 @@ import org.apache.flink.types.NullValue;
/**
* A gather-sum-apply implementation of the Weakly Connected Components algorithm.
*
- * This implementation uses a comparable vertex value as initial component
+ * <p>This implementation uses a comparable vertex value as initial component
* identifier (ID). In the gather phase, each vertex collects the vertex value
* of their adjacent vertices. In the sum phase, the minimum among those values
* is selected. In the apply phase, the algorithm sets the minimum value as the
* new vertex value if it is smaller than the current value.
*
- * The algorithm converges when vertices no longer update their component ID
+ * <p>The algorithm converges when vertices no longer update their component ID
* value or when the maximum number of iterations has been reached.
*
- * The result is a DataSet of vertices, where the vertex value corresponds to
+ * <p>The result is a DataSet of vertices, where the vertex value corresponds to
* the assigned component ID.
- *
+ *
* @see ConnectedComponents
*/
public class GSAConnectedComponents<K, VV extends Comparable<VV>, EV>
@@ -60,7 +60,7 @@ public class GSAConnectedComponents<K, VV extends Comparable<VV>, EV>
* The algorithm computes weakly connected components
* and converges when no vertex updates its component ID
* or when the maximum number of iterations has been reached.
- *
+ *
* @param maxIterations The maximum number of iterations to run.
*/
public GSAConnectedComponents(Integer maxIterations) {
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/GSASingleSourceShortestPaths.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/GSASingleSourceShortestPaths.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/GSASingleSourceShortestPaths.java
index 3f817f4..2d0b8da 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/GSASingleSourceShortestPaths.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/GSASingleSourceShortestPaths.java
@@ -29,7 +29,7 @@ import org.apache.flink.graph.gsa.Neighbor;
import org.apache.flink.graph.gsa.SumFunction;
/**
- * This is an implementation of the Single Source Shortest Paths algorithm, using a gather-sum-apply iteration
+ * This is an implementation of the Single Source Shortest Paths algorithm, using a gather-sum-apply iteration.
*/
public class GSASingleSourceShortestPaths<K, VV> implements
GraphAlgorithm<K, VV, Double, DataSet<Vertex<K, Double>>> {
@@ -39,7 +39,7 @@ public class GSASingleSourceShortestPaths<K, VV> implements
/**
* Creates an instance of the GSA SingleSourceShortestPaths algorithm.
- *
+ *
* @param srcVertexId The ID of the source vertex.
* @param maxIterations The maximum number of iterations to run.
*/
@@ -58,7 +58,7 @@ public class GSASingleSourceShortestPaths<K, VV> implements
}
@SuppressWarnings("serial")
- public static final class InitVerticesMapper<K, VV> implements MapFunction<Vertex<K, VV>, Double> {
+ private static final class InitVerticesMapper<K, VV> implements MapFunction<Vertex<K, VV>, Double> {
private K srcVertexId;
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/LabelPropagation.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/LabelPropagation.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/LabelPropagation.java
index 0064a68..1e700f4 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/LabelPropagation.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/LabelPropagation.java
@@ -41,7 +41,7 @@ import java.util.Map.Entry;
* detects communities by propagating labels. In each iteration, a vertex adopts
* the label that is most frequent among its neighbors' labels.
*
- * The initial vertex values are used as initial labels and are expected to be
+ * <p>The initial vertex values are used as initial labels and are expected to be
* {@link Comparable}. In case of a tie (i.e. two or more labels appear with the
* same frequency), the algorithm picks the greater label. The algorithm converges
* when no vertex changes its value or the maximum number of iterations has been
@@ -61,10 +61,10 @@ public class LabelPropagation<K, VV extends Comparable<VV>, EV>
* Creates a new Label Propagation algorithm instance.
* The algorithm converges when vertices no longer update their value
* or when the maximum number of iterations is reached.
- *
+ *
* @see <a href="http://journals.aps.org/pre/abstract/10.1103/PhysRevE.76.036106">
* Near linear time algorithm to detect community structures in large-scale networks</a>
- *
+ *
* @param maxIterations The maximum number of iterations to run.
*/
public LabelPropagation(int maxIterations) {
@@ -84,7 +84,7 @@ public class LabelPropagation<K, VV extends Comparable<VV>, EV>
}
/**
- * Sends the vertex label to all out-neighbors
+ * Sends the vertex label to all out-neighbors.
*/
public static final class SendNewLabelToNeighbors<K, VV extends Comparable<VV>>
extends ScatterFunction<K, VV, VV, NullValue>
@@ -108,7 +108,7 @@ public class LabelPropagation<K, VV extends Comparable<VV>, EV>
/**
* Function that updates the value of a vertex by adopting the most frequent
- * label among its in-neighbors
+ * label among its in-neighbors.
*/
public static final class UpdateVertexLabel<K, VV extends Comparable<VV>> extends GatherFunction<K, VV, VV> {
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/SingleSourceShortestPaths.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/SingleSourceShortestPaths.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/SingleSourceShortestPaths.java
index 16b51bc..15f0a84 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/SingleSourceShortestPaths.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/SingleSourceShortestPaths.java
@@ -39,7 +39,7 @@ public class SingleSourceShortestPaths<K, VV> implements GraphAlgorithm<K, VV, D
/**
* Creates an instance of the SingleSourceShortestPaths algorithm.
- *
+ *
* @param srcVertexId The ID of the source vertex.
* @param maxIterations The maximum number of iterations to run.
*/
@@ -56,7 +56,7 @@ public class SingleSourceShortestPaths<K, VV> implements GraphAlgorithm<K, VV, D
maxIterations).getVertices();
}
- public static final class InitVerticesMapper<K, VV> implements MapFunction<Vertex<K, VV>, Double> {
+ private static final class InitVerticesMapper<K, VV> implements MapFunction<Vertex<K, VV>, Double> {
private K srcVertexId;
@@ -94,7 +94,7 @@ public class SingleSourceShortestPaths<K, VV> implements GraphAlgorithm<K, VV, D
/**
* Function that updates the value of a vertex by picking the minimum
* distance from all incoming messages.
- *
+ *
* @param <K>
*/
public static final class VertexDistanceUpdater<K> extends GatherFunction<K, Double, Double> {
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/Summarization.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/Summarization.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/Summarization.java
index fed4d89..44ea988 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/Summarization.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/Summarization.java
@@ -37,49 +37,52 @@ import org.apache.flink.types.NullValue;
import org.apache.flink.util.Collector;
/**
- * The summarization algorithm computes a condensed version of the input graph<br>
- * by grouping vertices and edges based on their values. By doing this, the<br>
- * algorithm helps to uncover insights about patterns and distributions in the<br>
+ * The summarization algorithm computes a condensed version of the input graph
+ * by grouping vertices and edges based on their values. By doing this, the
+ * algorithm helps to uncover insights about patterns and distributions in the
* graph.
- * <p>
- * In the resulting graph, each vertex represents a group of vertices that share the<br>
- * same vertex value. An edge, that connects a vertex with itself, represents all edges<br>
- * with the same edge value that connect vertices inside that group. An edge between<br>
- * vertices in the output graph represents all edges with the same edge value between<br>
+ *
+ * <p>In the resulting graph, each vertex represents a group of vertices that share the
+ * same vertex value. An edge, that connects a vertex with itself, represents all edges
+ * with the same edge value that connect vertices inside that group. An edge between
+ * vertices in the output graph represents all edges with the same edge value between
* members of those groups in the input graph.
- * <p>
- * Consider the following example:
- * <p>
- * Input graph:
- * <p>
- * Vertices (id, value):<br>
- * (0, "A")<br>
- * (1, "A")<br>
- * (2, "B")<br>
- * (3, "B")<br>
- * <p>
+ *
+ * <p>Consider the following example:
+ *
+ * <p>Input graph:
+ *
+ * <pre>
+ * Vertices (id, value):
+ * (0, "A")
+ * (1, "A")
+ * (2, "B")
+ * (3, "B")
+ *
* Edges (source, target, value):
- * (0,1, null)<br>
- * (1,0, null)<br>
- * (1,2, null)<br>
- * (2,1, null)<br>
- * (2,3, null)<br>
- * (3,2, null)<br>
- * <p>
- * Output graph:
- * <p>
- * Vertices (id, (value, count)):<br>
- * (0, ("A", 2)) // 0 and 1 <br>
- * (2, ("B", 2)) // 2 and 3 <br>
- * <p>
- * Edges (source, target, (value, count)):<br>
- * (0, 0, (null, 2)) // (0,1) and (1,0) <br>
- * (2, 2, (null, 2)) // (2,3) and (3,2) <br>
- * (0, 2, (null, 1)) // (1,2) <br>
- * (2, 0, (null, 1)) // (2,1) <br>
+ * (0,1, null)
+ * (1,0, null)
+ * (1,2, null)
+ * (2,1, null)
+ * (2,3, null)
+ * (3,2, null)
+ * </pre>
+ *
+ * <p>Output graph:
+ *
+ * <pre>Vertices (id, (value, count)):
+ * (0, ("A", 2)) // 0 and 1
+ * (2, ("B", 2)) // 2 and 3
+ *
+ * Edges (source, target, (value, count)):
+ * (0, 0, (null, 2)) // (0,1) and (1,0)
+ * (2, 2, (null, 2)) // (2,3) and (3,2)
+ * (0, 2, (null, 1)) // (1,2)
+ * (2, 0, (null, 1)) // (2,1)
+ * </pre>
*
- * Note that this implementation is non-deterministic in the way that it assigns<br>
- * identifiers to summarized vertices. However, it is guaranteed that the identifier<br>
+ * <p>Note that this implementation is non-deterministic in the way that it assigns
+ * identifiers to summarized vertices. However, it is guaranteed that the identifier
* is one of the represented vertex identifiers.
*
* @param <K> vertex identifier type
@@ -138,8 +141,10 @@ public class Summarization<K, VV, EV>
/**
* Value that is stored at a summarized vertex.
*
+ * <pre>
* f0: vertex group value
* f1: vertex group count
+ * </pre>
*
* @param <VV> vertex value type
*/
@@ -166,8 +171,10 @@ public class Summarization<K, VV, EV>
/**
* Value that is stored at a summarized edge.
*
+ * <pre>
* f0: edge group value
* f1: edge group count
+ * </pre>
*
* @param <EV> edge value type
*/
@@ -194,10 +201,12 @@ public class Summarization<K, VV, EV>
/**
* Represents a single vertex in a vertex group.
*
+ * <pre>
* f0: vertex identifier
* f1: vertex group representative identifier
* f2: vertex group value
* f3: vertex group count
+ * </pre>
*
* @param <K> vertex identifier type
* @param <VGV> vertex group value type
@@ -288,7 +297,7 @@ public class Summarization<K, VV, EV>
* Creates one {@link VertexGroupItem} for each group element containing the vertex identifier and the identifier
* of the group representative which is the first vertex in the reduce input iterable.
*
- * Creates one {@link VertexGroupItem} representing the whole group that contains the vertex identifier of the
+ * <p>Creates one {@link VertexGroupItem} representing the whole group that contains the vertex identifier of the
* group representative, the vertex group value and the total number of group elements.
*
* @param <K> vertex identifier type
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/TriangleEnumerator.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/TriangleEnumerator.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/TriangleEnumerator.java
index 6296618..2ae6120 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/TriangleEnumerator.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/TriangleEnumerator.java
@@ -39,24 +39,21 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-
/**
* This library method enumerates unique triangles present in the input graph.
* A triangle consists of three edges that connect three vertices with each other.
* Edge directions are ignored here.
* The method returns a DataSet of Tuple3, where the fields of each Tuple3 contain the Vertex IDs of a triangle.
- * <p>
- * <p>
- * The basic algorithm works as follows:
- * It groups all edges that share a common vertex and builds triads, i.e., triples of vertices
- * that are connected by two edges. Finally, all triads are filtered for which no third edge exists
- * that closes the triangle.
- * <p>
- * <p>
- * For a group of <i>n</i> edges that share a common vertex, the number of built triads is quadratic <i>((n*(n-1))/2)</i>.
+ *
+ * <p>The basic algorithm groups all edges that share a common vertex and builds triads,
+ * i.e., triples of vertices that are connected by two edges. Then all triads are filtered
+ * for which no third edge exists that closes the triangle.
+ *
+ * <p>For a group of <i>n</i> edges that share a common vertex, the number of built triads is quadratic <i>((n*(n-1))/2)</i>.
* Therefore, an optimization of the algorithm is to group edges on the vertex with the smaller output degree to
* reduce the number of triads.
- * This implementation extends the basic algorithm by computing output degrees of edge vertices and
+ *
+ * <p>This implementation extends the basic algorithm by computing output degrees of edge vertices and
* grouping on edges on the vertex with the smaller degree.
*/
public class TriangleEnumerator<K extends Comparable<K>, VV, EV> implements
@@ -276,6 +273,11 @@ public class TriangleEnumerator<K extends Comparable<K>, VV, EV> implements
}
}
+ /**
+ * POJO storing two vertex IDs with degree.
+ *
+ * @param <K> vertex ID type
+ */
@SuppressWarnings("serial")
public static final class EdgeWithDegrees<K> extends Tuple4<K, K, Integer, Integer> {
@@ -324,6 +326,11 @@ public class TriangleEnumerator<K extends Comparable<K>, VV, EV> implements
}
}
+ /**
+ * Tuple storing three vertex IDs.
+ *
+ * @param <K> vertex ID type
+ */
public static final class Triad<K> extends Tuple3<K, K, K> {
private static final long serialVersionUID = 1L;
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/clustering/directed/AverageClusteringCoefficient.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/clustering/directed/AverageClusteringCoefficient.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/clustering/directed/AverageClusteringCoefficient.java
index 46bed68..bfeb3d5 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/clustering/directed/AverageClusteringCoefficient.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/clustering/directed/AverageClusteringCoefficient.java
@@ -18,18 +18,19 @@
package org.apache.flink.graph.library.clustering.directed;
-import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.flink.api.common.accumulators.DoubleCounter;
import org.apache.flink.api.common.accumulators.LongCounter;
import org.apache.flink.api.java.DataSet;
-import org.apache.flink.graph.AbstractGraphAnalytic;
import org.apache.flink.graph.AnalyticHelper;
import org.apache.flink.graph.Graph;
+import org.apache.flink.graph.GraphAnalyticBase;
import org.apache.flink.graph.asm.result.PrintableResult;
import org.apache.flink.graph.library.clustering.directed.AverageClusteringCoefficient.Result;
import org.apache.flink.types.CopyableValue;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+
import java.io.IOException;
import static org.apache.flink.api.common.ExecutionConfig.PARALLELISM_DEFAULT;
@@ -43,7 +44,7 @@ import static org.apache.flink.api.common.ExecutionConfig.PARALLELISM_DEFAULT;
* @param <EV> edge value type
*/
public class AverageClusteringCoefficient<K extends Comparable<K> & CopyableValue<K>, VV, EV>
-extends AbstractGraphAnalytic<K, VV, EV, Result> {
+extends GraphAnalyticBase<K, VV, EV, Result> {
private static final String VERTEX_COUNT = "vertexCount";
@@ -181,11 +182,19 @@ extends AbstractGraphAnalytic<K, VV, EV, Result> {
@Override
public boolean equals(Object obj) {
- if (obj == null) { return false; }
- if (obj == this) { return true; }
- if (obj.getClass() != getClass()) { return false; }
+ if (obj == null) {
+ return false;
+ }
+
+ if (obj == this) {
+ return true;
+ }
+
+ if (obj.getClass() != getClass()) {
+ return false;
+ }
- Result rhs = (Result)obj;
+ Result rhs = (Result) obj;
return new EqualsBuilder()
.append(vertexCount, rhs.vertexCount)
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/clustering/directed/GlobalClusteringCoefficient.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/clustering/directed/GlobalClusteringCoefficient.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/clustering/directed/GlobalClusteringCoefficient.java
index 20a6ec5..03f06b1 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/clustering/directed/GlobalClusteringCoefficient.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/clustering/directed/GlobalClusteringCoefficient.java
@@ -18,17 +18,18 @@
package org.apache.flink.graph.library.clustering.directed;
-import org.apache.commons.lang3.builder.EqualsBuilder;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.flink.api.java.DataSet;
-import org.apache.flink.graph.AbstractGraphAnalytic;
import org.apache.flink.graph.Graph;
+import org.apache.flink.graph.GraphAnalyticBase;
import org.apache.flink.graph.asm.dataset.Count;
import org.apache.flink.graph.asm.result.PrintableResult;
import org.apache.flink.graph.library.clustering.directed.GlobalClusteringCoefficient.Result;
import org.apache.flink.graph.library.metric.directed.VertexMetrics;
import org.apache.flink.types.CopyableValue;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+
import static org.apache.flink.api.common.ExecutionConfig.PARALLELISM_DEFAULT;
/**
@@ -40,7 +41,7 @@ import static org.apache.flink.api.common.ExecutionConfig.PARALLELISM_DEFAULT;
* @param <EV> edge value type
*/
public class GlobalClusteringCoefficient<K extends Comparable<K> & CopyableValue<K>, VV, EV>
-extends AbstractGraphAnalytic<K, VV, EV, Result> {
+extends GraphAnalyticBase<K, VV, EV, Result> {
private Count<TriangleListing.Result<K>> triangleCount;
@@ -142,13 +143,13 @@ extends AbstractGraphAnalytic<K, VV, EV, Result> {
* number of closed triplets (triangles) divided by the total number of
* triplets.
*
- * A score of {@code Double.NaN} is returned for a graph of isolated vertices
+ * <p>A score of {@code Double.NaN} is returned for a graph of isolated vertices
* for which both the triangle count and number of neighbors are zero.
*
* @return global clustering coefficient score
*/
public double getGlobalClusteringCoefficientScore() {
- return (tripletCount == 0) ? Double.NaN : triangleCount / (double)tripletCount;
+ return (tripletCount == 0) ? Double.NaN : triangleCount / (double) tripletCount;
}
@Override
@@ -168,11 +169,19 @@ extends AbstractGraphAnalytic<K, VV, EV, Result> {
@Override
public boolean equals(Object obj) {
- if (obj == null) { return false; }
- if (obj == this) { return true; }
- if (obj.getClass() != getClass()) { return false; }
+ if (obj == null) {
+ return false;
+ }
+
+ if (obj == this) {
+ return true;
+ }
+
+ if (obj.getClass() != getClass()) {
+ return false;
+ }
- Result rhs = (Result)obj;
+ Result rhs = (Result) obj;
return new EqualsBuilder()
.append(tripletCount, rhs.tripletCount)
http://git-wip-us.apache.org/repos/asf/flink/blob/d313ac76/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/clustering/directed/LocalClusteringCoefficient.java
----------------------------------------------------------------------
diff --git a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/clustering/directed/LocalClusteringCoefficient.java b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/clustering/directed/LocalClusteringCoefficient.java
index 92b14e3..b980244 100644
--- a/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/clustering/directed/LocalClusteringCoefficient.java
+++ b/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/clustering/directed/LocalClusteringCoefficient.java
@@ -35,7 +35,7 @@ import org.apache.flink.graph.asm.degree.annotate.directed.VertexDegrees.Degrees
import org.apache.flink.graph.asm.result.PrintableResult;
import org.apache.flink.graph.asm.result.UnaryResult;
import org.apache.flink.graph.library.clustering.directed.LocalClusteringCoefficient.Result;
-import org.apache.flink.graph.utils.Murmur3_32;
+import org.apache.flink.graph.utils.MurmurHash;
import org.apache.flink.graph.utils.proxy.GraphAlgorithmWrappingDataSet;
import org.apache.flink.graph.utils.proxy.OptionalBoolean;
import org.apache.flink.types.CopyableValue;
@@ -49,12 +49,12 @@ import static org.apache.flink.api.common.ExecutionConfig.PARALLELISM_DEFAULT;
* The local clustering coefficient measures the connectedness of each vertex's
* neighborhood. Scores range from 0.0 (no edges between neighbors) to 1.0
* (neighborhood is a clique).
- * <p>
- * An edge between a vertex's neighbors is a triangle. Counting edges between
+ *
+ * <p>An edge between a vertex's neighbors is a triangle. Counting edges between
* neighbors is equivalent to counting the number of triangles which include
* the vertex.
- * <p>
- * The input graph must be a simple graph containing no duplicate edges or
+ *
+ * <p>The input graph must be a simple graph containing no duplicate edges or
* self-loops.
*
* @param <K> graph ID type
@@ -98,6 +98,7 @@ extends GraphAlgorithmWrappingDataSet<K, VV, EV, Result<K>> {
return this;
}
+
@Override
protected String getAlgorithmName() {
return LocalClusteringCoefficient.class.getName();
@@ -107,7 +108,7 @@ extends GraphAlgorithmWrappingDataSet<K, VV, EV, Result<K>> {
protected boolean mergeConfiguration(GraphAlgorithmWrappingDataSet other) {
Preconditions.checkNotNull(other);
- if (! LocalClusteringCoefficient.class.isAssignableFrom(other.getClass())) {
+ if (!LocalClusteringCoefficient.class.isAssignableFrom(other.getClass())) {
return false;
}
@@ -257,7 +258,7 @@ extends GraphAlgorithmWrappingDataSet<K, VV, EV, Result<K>> {
implements PrintableResult, UnaryResult<T> {
public static final int HASH_SEED = 0x37a208c4;
- private Murmur3_32 hasher = new Murmur3_32(HASH_SEED);
+ private MurmurHash hasher = new MurmurHash(HASH_SEED);
@Override
public T getVertexId0() {
@@ -293,7 +294,7 @@ extends GraphAlgorithmWrappingDataSet<K, VV, EV, Result<K>> {
* number of edges between neighbors, equal to the triangle count,
* divided by the number of potential edges between neighbors.
*
- * A score of {@code Double.NaN} is returned for a vertex with degree 1
+ * <p>A score of {@code Double.NaN} is returned for a vertex with degree 1
* for which both the triangle count and number of neighbors are zero.
*
* @return local clustering coefficient score
@@ -302,7 +303,7 @@ extends GraphAlgorithmWrappingDataSet<K, VV, EV, Result<K>> {
long degree = getDegree().getValue();
long neighborPairs = degree * (degree - 1);
- return (neighborPairs == 0) ? Double.NaN : getTriangleCount().getValue() / (double)neighborPairs;
+ return (neighborPairs == 0) ? Double.NaN : getTriangleCount().getValue() / (double) neighborPairs;
}
/**