[
https://issues.apache.org/jira/browse/FLINK-2044?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15290887#comment-15290887
]
ASF GitHub Bot commented on FLINK-2044:
---------------------------------------
Github user gallenvara commented on a diff in the pull request:
https://github.com/apache/flink/pull/1956#discussion_r63856640
--- Diff:
flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/library/HITSAlgorithm.java
---
@@ -122,22 +179,45 @@ public void updateVertex(Vertex<K,
Tuple2<DoubleValue, DoubleValue>> vertex, Mes
DoubleValue newAuthorityValue = vertex.getValue().f1;
if (getSuperstepNumber() > 1) {
- iterationValueSum = Math.sqrt(((DoubleValue)
getPreviousIterationAggregate("sumVertexValue")).getValue());
+ iterationValueSum = Math.sqrt(((DoubleValue)
getPreviousIterationAggregate("updatedValueSum")).getValue());
}
- if (getSuperstepNumber() != maxIteration) {
+ if (getSuperstepNumber() < maxIteration) {
if (getSuperstepNumber() % 2 == 1) {
-
newHubValue.setValue(newHubValue.getValue() / iterationValueSum);
- newAuthorityValue.setValue(updateValue);
+
+ //in the first iteration, the diff is
the authority value of each vertex
+ double previousAuthAverage = 1.0;
+ double diffValueSum = 1.0 *
numberOfVertices;
+ if (getSuperstepNumber() > 1) {
+ previousAuthAverage =
((DoubleValue) getPreviousIterationAggregate("authorityValueSum")).getValue() /
numberOfVertices;
+ diffValueSum = ((DoubleValue)
getPreviousIterationAggregate("diffValueSum")).getValue();
+ }
+
authoritySumAggregator.aggregate(previousAuthAverage);
+
+ if (diffValueSum > convergeThreshold) {
+
newHubValue.setValue(newHubValue.getValue() / iterationValueSum);
+
newAuthorityValue.setValue(updateValue);
+ } else {
+
+ //scores are converged and stop
iteration
+ maxIteration =
getSuperstepNumber();
--- End diff --
This line can stop the iteration after last vertex updating(final updating
of hub normalization). If drop this line, the iteration will go on until
`getSuperstep == maxIteration` because there are always some vertices can be
updated.
> Implementation of Gelly HITS Algorithm
> --------------------------------------
>
> Key: FLINK-2044
> URL: https://issues.apache.org/jira/browse/FLINK-2044
> Project: Flink
> Issue Type: New Feature
> Components: Gelly
> Reporter: Ahamd Javid
> Assignee: GaoLun
> Priority: Minor
>
> Implementation of Hits Algorithm in Gelly API using Java. the feature branch
> can be found here: (https://github.com/JavidMayar/flink/commits/HITS)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)