.groupBy(0) .aggregate(Aggregations.SUM, 1) .map(new MapFunction<Tuple2<Long, Long>, Long>() { @Override public Long map(Tuple2<Long, Long> value) throws Exception {
.map(new Dampener(DAMPENING_FACTOR, numPages));
.map(new Dampener(0.85, 10));
public static DataSet<Tuple2<Long, Double>> constructPlan(DataSet<Tuple2<Long, Double>> initialData, int numIterations) { DeltaIteration<Tuple2<Long, Double>, Tuple2<Long, Double>> iteration = initialData.iterateDelta(initialData, numIterations, 0); DataSet<Tuple2<Long, Double>> delta = iteration.getSolutionSet() .join(iteration.getWorkset().flatMap(new Duplicator())).where(0).equalTo(0).with(new SummingJoin()).name(JOIN_1) .groupBy(0).aggregate(Aggregations.MIN, 1).map(new Expander()) .join(iteration.getSolutionSet()).where(0).equalTo(0).with(new SummingJoinProject()).name(JOIN_2); DataSet<Tuple2<Long, Double>> changes = delta.groupBy(0).aggregate(Aggregations.SUM, 1); DataSet<Tuple2<Long, Double>> result = iteration.closeWith(delta, changes); return result; }
/** * Counts the elements in the given dataset and stores the result in a * 1-element dataset. * * @param dataSet input dataset * @param <T> element type in input dataset * @return 1-element dataset with count of input dataset */ public static <T> DataSet<Long> count(DataSet<T> dataSet) { return dataSet .map(new Tuple1With1L<T>()) .union(dataSet.getExecutionEnvironment().fromElements(new Tuple1<>(0L))) .sum(0) .map(new ValueOf1<>()); }
/** * Counts the elements in the given dataset and stores the result in a * 1-element dataset. * * @param dataSet input dataset * @param <T> element type in input dataset * @return 1-element dataset with count of input dataset */ public static <T> DataSet<Long> count(DataSet<T> dataSet) { return dataSet .map(new Tuple1With1L<T>()) .union(dataSet.getExecutionEnvironment().fromElements(new Tuple1<>(0L))) .sum(0) .map(new ValueOf1<>()); }
@Override public DataSet<WithCount<String>> execute(LogicalGraph graph) { return graph.getEdges() .map(new ToSourceIdWithLabel<>()) .groupBy(0, 1) .first(1) .<Tuple1<String>>project(1) .map(new Tuple2FromTupleWithObjectAnd1L<>()) .groupBy(0) .sum(1) .map(new Tuple2ToWithCount<>()); }
@Override public DataSet<WithCount<String>> execute(LogicalGraph graph) { return graph.getEdges() .map(new ToTargetIdWithLabel<>()) .groupBy(0, 1) .first(1) .<Tuple1<String>>project(1) .map(new Tuple2FromTupleWithObjectAnd1L<>()) .groupBy(0) .sum(1) .map(new Tuple2ToWithCount<>()); }
@Override public DataSet<WithCount<String>> execute(LogicalGraph graph) { return graph.getEdges() .map(new ToTargetIdWithLabel<>()) .groupBy(0, 1) .first(1) .<Tuple1<String>>project(1) .map(new Tuple2FromTupleWithObjectAnd1L<>()) .groupBy(0) .sum(1) .map(new Tuple2ToWithCount<>()); } }
@Override public DataSet<WithCount<String>> execute(LogicalGraph graph) { return graph.getEdges() .map(new ToSourceIdWithLabel<>()) .groupBy(0, 1) .first(1) .<Tuple1<String>>project(1) .map(new Tuple2FromTupleWithObjectAnd1L<>()) .groupBy(0) .sum(1) .map(new Tuple2ToWithCount<>()); } }
.map(new Dampener(DAMPENING_FACTOR, numPages));
.map(new Dampener(DAMPENING_FACTOR, numPages));
.map(new Dampener(DAMPENING_FACTOR, numPages));
.map(new Dampener(DAMPENING_FACTOR, numPages));