Java Code Examples for org.apache.flink.types.LongValue

The following examples show how to use org.apache.flink.types.LongValue. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: Flink-CEPplus   Source File: AggregateITCase.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testNestedAggregateOfMutableValueTypes() throws Exception {
	/*
	 * Nested Aggregate of mutable value types
	 */

	final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();

	DataSet<Tuple3<IntValue, LongValue, StringValue>> ds = ValueCollectionDataSets.get3TupleDataSet(env);
	DataSet<Tuple1<IntValue>> aggregateDs = ds.groupBy(1)
			.aggregate(Aggregations.MIN, 0)
			.aggregate(Aggregations.MIN, 0)
			.project(0);

	List<Tuple1<IntValue>> result = aggregateDs.collect();

	String expected = "1\n";

	compareResultAsTuples(result, expected);
}
 
Example 2
Source Project: flink   Source File: HypercubeGraphTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testGraphMetrics() throws Exception {
	int dimensions = 10;

	Graph<LongValue, NullValue, NullValue> graph = new HypercubeGraph(env, dimensions)
		.generate();

	assertEquals(1L << dimensions, graph.numberOfVertices());
	assertEquals(dimensions * (1L << dimensions), graph.numberOfEdges());

	long minInDegree = graph.inDegrees().min(1).collect().get(0).f1.getValue();
	long minOutDegree = graph.outDegrees().min(1).collect().get(0).f1.getValue();
	long maxInDegree = graph.inDegrees().max(1).collect().get(0).f1.getValue();
	long maxOutDegree = graph.outDegrees().max(1).collect().get(0).f1.getValue();

	assertEquals(dimensions, minInDegree);
	assertEquals(dimensions, minOutDegree);
	assertEquals(dimensions, maxInDegree);
	assertEquals(dimensions, maxOutDegree);
}
 
Example 3
@Override
public void preSuperstep() {

	// test bcast variable
	@SuppressWarnings("unchecked")
	List<Integer> bcastSet = (List<Integer>) (List<?>) getBroadcastSet("messagingBcastSet");
	Assert.assertEquals(4, bcastSet.get(0).intValue());
	Assert.assertEquals(5, bcastSet.get(1).intValue());
	Assert.assertEquals(6, bcastSet.get(2).intValue());

	// test number of vertices
	Assert.assertEquals(5, getNumberOfVertices());

	// test aggregator
	if (getSuperstepNumber() == 2) {
		long aggrValue = ((LongValue) getPreviousIterationAggregate("superstepAggregator")).getValue();
		Assert.assertEquals(5, aggrValue);
	}
}
 
Example 4
Source Project: Flink-CEPplus   Source File: RMatGraph.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public Graph<LongValue, NullValue, NullValue> generate() {
	int scale = Long.SIZE - Long.numberOfLeadingZeros(vertexCount - 1);

	// Edges
	int cyclesPerEdge = noiseEnabled ? 5 * scale : scale;

	List<BlockInfo<T>> generatorBlocks = randomGenerableFactory
		.getRandomGenerables(edgeCount, cyclesPerEdge);

	DataSet<Edge<LongValue, NullValue>> edges = env
		.fromCollection(generatorBlocks)
			.name("Random generators")
		.rebalance()
			.setParallelism(parallelism)
			.name("Rebalance")
		.flatMap(new GenerateEdges<>(vertexCount, scale, a, b, c, noiseEnabled, noise))
			.setParallelism(parallelism)
			.name("RMat graph edges");

	// Vertices
	DataSet<Vertex<LongValue, NullValue>> vertices = GraphGeneratorUtils.vertexSet(edges, parallelism);

	// Graph
	return Graph.fromDataSet(vertices, edges, env);
}
 
Example 5
Source Project: flink   Source File: LocalPropertiesFilteringTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testSortingPreserved4() {
	SingleInputSemanticProperties sp = new SingleInputSemanticProperties();
	SemanticPropUtil.getSemanticPropsSingleFromString(sp, new String[]{"2->7;5"}, null, null, tupleInfo, tupleInfo);

	Ordering o = new Ordering();
	o.appendOrdering(2, IntValue.class, Order.ASCENDING);
	o.appendOrdering(0, StringValue.class, Order.DESCENDING);
	o.appendOrdering(5, LongValue.class, Order.DESCENDING);
	LocalProperties lProps = LocalProperties.forOrdering(o);

	LocalProperties filtered = lProps.filterBySemanticProperties(sp, 0);
	FieldList gFields = filtered.getGroupedFields();
	Ordering order = filtered.getOrdering();

	assertNotNull(gFields);
	assertEquals(1, gFields.size());
	assertTrue(gFields.contains(7));
	assertNotNull(order);
	assertEquals(1, order.getNumberOfFields());
	assertEquals(7, order.getFieldNumber(0).intValue());
	assertEquals(Order.ASCENDING, order.getOrder(0));
	assertEquals(IntValue.class, order.getType(0));
	assertNull(filtered.getUniqueFields());
}
 
Example 6
Source Project: Flink-CEPplus   Source File: DegreesITCase.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testGetDegreesWithDisconnectedData() throws Exception {
	/*
	 * Test getDegrees() with disconnected data
	 */
	final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();

	Graph<Long, NullValue, Long> graph =
		Graph.fromDataSet(TestGraphUtils.getDisconnectedLongLongEdgeData(env), env);

	DataSet<Tuple2<Long, LongValue>> data = graph.outDegrees();
	List<Tuple2<Long, LongValue>> result = data.collect();

	expectedResult = "1,2\n" +
		"2,1\n" +
		"3,0\n" +
		"4,1\n" +
		"5,0\n";

	compareResultAsTuples(result, expectedResult);
}
 
Example 7
Source Project: flink   Source File: ScatterGatherConfigurationITCase.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public void preSuperstep() {

	// test bcast variable
	@SuppressWarnings("unchecked")
	List<Integer> bcastSet = (List<Integer>) (List<?>) getBroadcastSet("messagingBcastSet");
	Assert.assertEquals(4, bcastSet.get(0).intValue());
	Assert.assertEquals(5, bcastSet.get(1).intValue());
	Assert.assertEquals(6, bcastSet.get(2).intValue());

	// test number of vertices
	Assert.assertEquals(5, getNumberOfVertices());

	// test aggregator
	if (getSuperstepNumber() == 2) {
		long aggrValue = ((LongValue) getPreviousIterationAggregate("superstepAggregator")).getValue();
		Assert.assertEquals(5, aggrValue);
	}
}
 
Example 8
Source Project: flink   Source File: VertexDegreeTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testWithEmptyGraphWithoutVertices() throws Exception {
	DataSet<Vertex<LongValue, LongValue>> degree;

	degree = emptyGraphWithoutVertices
		.run(new VertexDegree<LongValue, NullValue, NullValue>()
			.setIncludeZeroDegreeVertices(false));

	assertEquals(0, degree.collect().size());

	degree = emptyGraphWithoutVertices
		.run(new VertexDegree<LongValue, NullValue, NullValue>()
			.setIncludeZeroDegreeVertices(true));

	assertEquals(0, degree.collect().size());
}
 
Example 9
Source Project: flink   Source File: EdgeSourceDegreeTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testWithRMatGraph() throws Exception {
	DataSet<Edge<LongValue, Tuple2<NullValue, LongValue>>> sourceDegreeOnSourceId = undirectedRMatGraph(10, 16)
		.run(new EdgeSourceDegree<LongValue, NullValue, NullValue>()
			.setReduceOnTargetId(false));

	Checksum checksumOnSourceId = new ChecksumHashCode<Edge<LongValue, Tuple2<NullValue, LongValue>>>()
		.run(sourceDegreeOnSourceId)
		.execute();

	assertEquals(20884, checksumOnSourceId.getCount());
	assertEquals(0x000000019d8f0070L, checksumOnSourceId.getChecksum());

	DataSet<Edge<LongValue, Tuple2<NullValue, LongValue>>> sourceDegreeOnTargetId = undirectedRMatGraph(10, 16)
		.run(new EdgeSourceDegree<LongValue, NullValue, NullValue>()
			.setReduceOnTargetId(true));

	Checksum checksumOnTargetId = new ChecksumHashCode<Edge<LongValue, Tuple2<NullValue, LongValue>>>()
		.run(sourceDegreeOnTargetId)
		.execute();

	assertEquals(checksumOnTargetId, checksumOnTargetId);
}
 
Example 10
Source Project: flink   Source File: RMatGraph.java    License: Apache License 2.0 6 votes vote down vote up
@Override
public Graph<LongValue, NullValue, NullValue> generate() {
	int scale = Long.SIZE - Long.numberOfLeadingZeros(vertexCount - 1);

	// Edges
	int cyclesPerEdge = noiseEnabled ? 5 * scale : scale;

	List<BlockInfo<T>> generatorBlocks = randomGenerableFactory
		.getRandomGenerables(edgeCount, cyclesPerEdge);

	DataSet<Edge<LongValue, NullValue>> edges = env
		.fromCollection(generatorBlocks)
			.name("Random generators")
		.rebalance()
			.setParallelism(parallelism)
			.name("Rebalance")
		.flatMap(new GenerateEdges<>(vertexCount, scale, a, b, c, noiseEnabled, noise))
			.setParallelism(parallelism)
			.name("RMat graph edges");

	// Vertices
	DataSet<Vertex<LongValue, NullValue>> vertices = GraphGeneratorUtils.vertexSet(edges, parallelism);

	// Graph
	return Graph.fromDataSet(vertices, edges, env);
}
 
Example 11
Source Project: flink   Source File: TriadicCensusTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testWithEmptyGraphWithoutVertices() throws Exception {
	Result expectedResult = new Result(0, 0, 0, 0);

	Result triadCensus = new TriadicCensus<LongValue, NullValue, NullValue>()
		.run(emptyGraphWithoutVertices)
		.execute();

	assertEquals(expectedResult, triadCensus);
}
 
Example 12
Source Project: Flink-CEPplus   Source File: TriangleListingTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testWithEmptyGraphWithVertices() throws Exception {
	DataSet<Result<LongValue>> tl = emptyGraphWithVertices
		.run(new TriangleListing<>());

	assertEquals(0, tl.collect().size());
}
 
Example 13
Source Project: flink   Source File: EdgeDegreesPairTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testWithEmptyGraphWithoutVertices() throws Exception {
	DataSet<Edge<LongValue, Tuple3<NullValue, Degrees, Degrees>>> degreesPair = emptyGraphWithoutVertices
		.run(new EdgeDegreesPair<>());

	assertEquals(0, degreesPair.collect().size());
}
 
Example 14
Source Project: flink   Source File: ScatterGatherIteration.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void open(Configuration parameters) throws Exception {
	if (getRuntimeContext().hasBroadcastVariable("number of vertices")) {
		Collection<LongValue> numberOfVertices = getRuntimeContext().getBroadcastVariable("number of vertices");
		this.scatterFunction.setNumberOfVertices(numberOfVertices.iterator().next().getValue());
	}
	if (getIterationRuntimeContext().getSuperstepNumber() == 1) {
		this.scatterFunction.init(getIterationRuntimeContext());
	}
	this.scatterFunction.preSuperstep();
}
 
Example 15
Source Project: flink   Source File: GatherSumApplyIteration.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void open(Configuration parameters) throws Exception {
	if (getRuntimeContext().hasBroadcastVariable("number of vertices")) {
		Collection<LongValue> numberOfVertices = getRuntimeContext().getBroadcastVariable("number of vertices");
		this.sumFunction.setNumberOfVertices(numberOfVertices.iterator().next().getValue());
	}
	if (getIterationRuntimeContext().getSuperstepNumber() == 1) {
		this.sumFunction.init(getIterationRuntimeContext());
	}
	this.sumFunction.preSuperstep();
}
 
Example 16
Source Project: flink   Source File: EchoGraphTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testGraphWithEvenVertexCountWithOddVertexDegree() throws Exception {
	Graph<LongValue, NullValue, NullValue> graph = new EchoGraph(env, 10, 3)
		.generate();

	String vertices = "0; 1; 2; 3; 4; 5; 6; 7; 8; 9";
	String edges = "0,4; 0,5; 0,6; 1,5; 1,6; 1,7; 2,6;" +
		"2,7; 2,8; 3,7; 3,8; 3,9; 4,0; 4,8; 4,9;" +
		"5,0; 5,1; 5,9; 6,0; 6,1; 6,2; 7,1; 7,2; 7,3;" +
		"8,2; 8,3; 8,4; 9,3; 9,4; 9,5";

	TestUtils.compareGraph(graph, vertices, edges);
}
 
Example 17
Source Project: flink   Source File: BulkIterationBase.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public boolean isConverged(int iteration, LongValue countAggregate) {
	long count = countAggregate.getValue();

	if (log.isInfoEnabled()) {
		log.info("Termination criterion stats in iteration [" + iteration + "]: " + count);
	}

	return count == 0;
}
 
Example 18
Source Project: flink   Source File: LongValueSummaryAggregatorTest.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Helper method for summarizing a list of values.
 */
@Override
protected NumericColumnSummary<Long> summarize(Long... values) {

	LongValue[] longValues = new LongValue[values.length];
	for (int i = 0; i < values.length; i++) {
		if (values[i] != null) {
			longValues[i] = new LongValue(values[i]);
		}
	}

	return new AggregateCombineHarness<LongValue, NumericColumnSummary<Long>, ValueSummaryAggregator.LongValueSummaryAggregator>() {

		@Override
		protected void compareResults(NumericColumnSummary<Long> result1, NumericColumnSummary<Long> result2) {

			Assert.assertEquals(result1.getTotalCount(), result2.getTotalCount());
			Assert.assertEquals(result1.getNullCount(), result2.getNullCount());
			Assert.assertEquals(result1.getMissingCount(), result2.getMissingCount());
			Assert.assertEquals(result1.getNonMissingCount(), result2.getNonMissingCount());
			Assert.assertEquals(result1.getInfinityCount(), result2.getInfinityCount());
			Assert.assertEquals(result1.getNanCount(), result2.getNanCount());

			Assert.assertEquals(result1.containsNull(), result2.containsNull());
			Assert.assertEquals(result1.containsNonNull(), result2.containsNonNull());

			Assert.assertEquals(result1.getMin().longValue(), result2.getMin().longValue());
			Assert.assertEquals(result1.getMax().longValue(), result2.getMax().longValue());
			Assert.assertEquals(result1.getSum().longValue(), result2.getSum().longValue());
			Assert.assertEquals(result1.getMean().doubleValue(), result2.getMean().doubleValue(), 1e-12d);
			Assert.assertEquals(result1.getVariance().doubleValue(), result2.getVariance().doubleValue(), 1e-9d);
			Assert.assertEquals(result1.getStandardDeviation().doubleValue(), result2.getStandardDeviation().doubleValue(), 1e-12d);
		}
	}.summarize(longValues);
}
 
Example 19
Source Project: flink   Source File: EmptyGraphTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testParallelism() throws Exception {
	int parallelism = 2;

	Graph<LongValue, NullValue, NullValue> graph = new EmptyGraph(env, 100)
		.setParallelism(parallelism)
		.generate();

	graph.getVertices().output(new DiscardingOutputFormat<>());
	graph.getEdges().output(new DiscardingOutputFormat<>());

	TestUtils.verifyParallelism(env, parallelism);
}
 
Example 20
Source Project: flink   Source File: GraphKeyTypeTransformTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testToShortValue() throws Exception {
	TranslateFunction<LongValue, ShortValue> translator = new LongValueToUnsignedShortValue();

	Assert.assertEquals(new ShortValue((short) 0),
		translator.translate(new LongValue(0L), shortValue));

	Assert.assertEquals(new ShortValue(Short.MIN_VALUE),
		translator.translate(new LongValue((long) Short.MAX_VALUE + 1), shortValue));

	Assert.assertEquals(new ShortValue((short) -1),
		translator.translate(new LongValue(LongValueToUnsignedShortValue.MAX_VERTEX_COUNT - 1), shortValue));
}
 
Example 21
Source Project: flink   Source File: LocalClusteringCoefficientTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testRMatGraph() throws Exception {
	DataSet<Result<LongValue>> cc = directedRMatGraph(10, 16)
		.run(new LocalClusteringCoefficient<>());

	Checksum checksum = new org.apache.flink.graph.asm.dataset.ChecksumHashCode<Result<LongValue>>()
		.run(cc)
		.execute();

	assertEquals(902, checksum.getCount());
	assertEquals(0x000001bf83866775L, checksum.getChecksum());
}
 
Example 22
Source Project: flink   Source File: EdgeDegreePairTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void testWithEmptyGraphWithoutVertices() throws Exception {
	DataSet<Edge<LongValue, Tuple3<NullValue, LongValue, LongValue>>> degreePairOnSourceId = emptyGraphWithoutVertices
		.run(new EdgeDegreePair<LongValue, NullValue, NullValue>()
			.setReduceOnTargetId(false));

	assertEquals(0, degreePairOnSourceId.collect().size());

	DataSet<Edge<LongValue, Tuple3<NullValue, LongValue, LongValue>>> degreePairOnTargetId = emptyGraphWithoutVertices
		.run(new EdgeDegreePair<LongValue, NullValue, NullValue>()
			.setReduceOnTargetId(true));

	assertEquals(0, degreePairOnTargetId.collect().size());
}
 
Example 23
Source Project: flink   Source File: GraphKeyTypeTransform.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public LongValueWithProperHashCode translate(LongValue value, LongValueWithProperHashCode reuse)
		throws Exception {
	if (reuse == null) {
		reuse = new LongValueWithProperHashCode();
	}

	reuse.setValue(value.getValue());
	return reuse;
}
 
Example 24
Source Project: flink   Source File: CSV.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Graph<K, NullValue, NullValue> create(ExecutionEnvironment env) throws Exception {
	GraphCsvReader reader = Graph.fromCsvReader(inputFilename.getValue(), env)
		.ignoreCommentsEdges(commentPrefix.getValue())
		.lineDelimiterEdges(lineDelimiter.getValue())
		.fieldDelimiterEdges(fieldDelimiter.getValue());

	Graph<K, NullValue, NullValue> graph;

	switch (type.getValue()) {
		case INTEGER:
			graph = (Graph<K, NullValue, NullValue>) reader
				.keyType(IntValue.class);
			break;

		case LONG:
			graph = (Graph<K, NullValue, NullValue>) reader
				.keyType(LongValue.class);
			break;

		case STRING:
			graph = (Graph<K, NullValue, NullValue>) reader
				.keyType(StringValue.class);
			break;

		default:
			throw new ProgramParametrizationException("Unknown type '" + type.getValue() + "'");
	}

	return simplify.simplify(graph, parallelism.getValue().intValue());
}
 
Example 25
Source Project: Flink-CEPplus   Source File: CirculantGraph.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Graph<LongValue, NullValue, NullValue> create(ExecutionEnvironment env) {
	org.apache.flink.graph.generator.CirculantGraph graph = new org.apache.flink.graph.generator.CirculantGraph(env,
		vertexCount.getValue());

	for (OffsetRange offsetRange : offsetRanges) {
		graph.addRange(offsetRange.getOffset(), offsetRange.getLength());
	}

	return graph
		.setParallelism(parallelism.getValue().intValue())
		.generate();
}
 
Example 26
Source Project: Flink-CEPplus   Source File: TriangleListing.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void flatMap(Edge<T, Tuple3<ET, LongValue, LongValue>> value, Collector<Tuple2<T, T>> out)
		throws Exception {
	Tuple3<ET, LongValue, LongValue> degrees = value.f2;
	long sourceDegree = degrees.f1.getValue();
	long targetDegree = degrees.f2.getValue();

	if (sourceDegree < targetDegree ||
			(sourceDegree == targetDegree && value.f0.compareTo(value.f1) < 0)) {
		edge.f0 = value.f0;
		edge.f1 = value.f1;
		out.collect(edge);
	}
}
 
Example 27
Source Project: flink   Source File: TriangleListing.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void flatMap(Edge<T, Tuple3<ET, LongValue, LongValue>> value, Collector<Tuple2<T, T>> out)
		throws Exception {
	Tuple3<ET, LongValue, LongValue> degrees = value.f2;
	long sourceDegree = degrees.f1.getValue();
	long targetDegree = degrees.f2.getValue();

	if (sourceDegree < targetDegree ||
			(sourceDegree == targetDegree && value.f0.compareTo(value.f1) < 0)) {
		edge.f0 = value.f0;
		edge.f1 = value.f1;
		out.collect(edge);
	}
}
 
Example 28
Source Project: Flink-CEPplus   Source File: ValueArrayTypeInfo.java    License: Apache License 2.0 5 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public TypeSerializer<ValueArray<T>> createSerializer(ExecutionConfig executionConfig) {
	Preconditions.checkNotNull(type, "TypeInformation type class is required");

	if (ByteValue.class.isAssignableFrom(type)) {
		return (TypeSerializer<ValueArray<T>>) (TypeSerializer<?>) new ByteValueArraySerializer();
	} else if (CharValue.class.isAssignableFrom(type)) {
		return (TypeSerializer<ValueArray<T>>) (TypeSerializer<?>) new CharValueArraySerializer();
	} else if (DoubleValue.class.isAssignableFrom(type)) {
		return (TypeSerializer<ValueArray<T>>) (TypeSerializer<?>) new DoubleValueArraySerializer();
	} else if (FloatValue.class.isAssignableFrom(type)) {
		return (TypeSerializer<ValueArray<T>>) (TypeSerializer<?>) new FloatValueArraySerializer();
	} else if (IntValue.class.isAssignableFrom(type)) {
		return (TypeSerializer<ValueArray<T>>) (TypeSerializer<?>) new IntValueArraySerializer();
	} else if (LongValue.class.isAssignableFrom(type)) {
		return (TypeSerializer<ValueArray<T>>) (TypeSerializer<?>) new LongValueArraySerializer();
	} else if (NullValue.class.isAssignableFrom(type)) {
		return (TypeSerializer<ValueArray<T>>) (TypeSerializer<?>) new NullValueArraySerializer();
	} else if (ShortValue.class.isAssignableFrom(type)) {
		return (TypeSerializer<ValueArray<T>>) (TypeSerializer<?>) new ShortValueArraySerializer();
	} else if (StringValue.class.isAssignableFrom(type)) {
		return (TypeSerializer<ValueArray<T>>) (TypeSerializer<?>) new StringValueArraySerializer();
	} else {
		throw new InvalidTypesException("No ValueArray class exists for " + type);
	}
}
 
Example 29
Source Project: flink   Source File: GridGraph.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Graph<LongValue, NullValue, NullValue> create(ExecutionEnvironment env) {
	org.apache.flink.graph.generator.GridGraph graph = new org.apache.flink.graph.generator.GridGraph(env);

	for (Dimension dimension : dimensions) {
		graph.addDimension(dimension.size, dimension.wrapEndpoints);
	}

	return graph
		.setParallelism(parallelism.getValue().intValue())
		.generate();
}
 
Example 30
Source Project: Flink-CEPplus   Source File: LocalClusteringCoefficient.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Result<T> join(Vertex<T, Degrees> vertexAndDegree, Tuple2<T, LongValue> vertexAndTriangleCount)
		throws Exception {
	output.setVertexId0(vertexAndDegree.f0);
	output.setDegree(vertexAndDegree.f1.f0);
	output.setTriangleCount((vertexAndTriangleCount == null) ? zero : vertexAndTriangleCount.f1);

	return output;
}