org.apache.flink.graph.asm.translate.TranslateVertexValues Java Examples
The following examples show how to use
org.apache.flink.graph.asm.translate.TranslateVertexValues.
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 File: SummarizationITCase.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
@Test public void testWithVertexAndEdgeLongValues() throws Exception { ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); Graph<Long, Long, Long> input = Graph.fromDataSet( SummarizationData.getVertices(env), SummarizationData.getEdges(env), env) .run(new TranslateVertexValues<>(new StringToLong())) .run(new TranslateEdgeValues<>(new StringToLong())); List<Vertex<Long, Summarization.VertexValue<Long>>> summarizedVertices = new ArrayList<>(); List<Edge<Long, EdgeValue<Long>>> summarizedEdges = new ArrayList<>(); Graph<Long, Summarization.VertexValue<Long>, EdgeValue<Long>> output = input.run(new Summarization<>()); output.getVertices().output(new LocalCollectionOutputFormat<>(summarizedVertices)); output.getEdges().output(new LocalCollectionOutputFormat<>(summarizedEdges)); env.execute(); validateVertices(SummarizationData.EXPECTED_VERTICES, summarizedVertices); validateEdges(SummarizationData.EXPECTED_EDGES_WITH_VALUES, summarizedEdges); }
Example #2
Source File: SummarizationITCase.java From flink with Apache License 2.0 | 6 votes |
@Test public void testWithVertexAndEdgeLongValues() throws Exception { ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); Graph<Long, Long, Long> input = Graph.fromDataSet( SummarizationData.getVertices(env), SummarizationData.getEdges(env), env) .run(new TranslateVertexValues<>(new StringToLong())) .run(new TranslateEdgeValues<>(new StringToLong())); List<Vertex<Long, Summarization.VertexValue<Long>>> summarizedVertices = new ArrayList<>(); List<Edge<Long, EdgeValue<Long>>> summarizedEdges = new ArrayList<>(); Graph<Long, Summarization.VertexValue<Long>, EdgeValue<Long>> output = input.run(new Summarization<>()); output.getVertices().output(new LocalCollectionOutputFormat<>(summarizedVertices)); output.getEdges().output(new LocalCollectionOutputFormat<>(summarizedEdges)); env.execute(); validateVertices(SummarizationData.EXPECTED_VERTICES, summarizedVertices); validateEdges(SummarizationData.EXPECTED_EDGES_WITH_VALUES, summarizedEdges); }
Example #3
Source File: SummarizationITCase.java From flink with Apache License 2.0 | 6 votes |
@Test public void testWithVertexAndEdgeLongValues() throws Exception { ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment(); Graph<Long, Long, Long> input = Graph.fromDataSet( SummarizationData.getVertices(env), SummarizationData.getEdges(env), env) .run(new TranslateVertexValues<>(new StringToLong())) .run(new TranslateEdgeValues<>(new StringToLong())); List<Vertex<Long, Summarization.VertexValue<Long>>> summarizedVertices = new ArrayList<>(); List<Edge<Long, EdgeValue<Long>>> summarizedEdges = new ArrayList<>(); Graph<Long, Summarization.VertexValue<Long>, EdgeValue<Long>> output = input.run(new Summarization<>()); output.getVertices().output(new LocalCollectionOutputFormat<>(summarizedVertices)); output.getEdges().output(new LocalCollectionOutputFormat<>(summarizedEdges)); env.execute(); validateVertices(SummarizationData.EXPECTED_VERTICES, summarizedVertices); validateEdges(SummarizationData.EXPECTED_EDGES_WITH_VALUES, summarizedEdges); }
Example #4
Source File: Graph.java From Flink-CEPplus with Apache License 2.0 | 2 votes |
/** * Translate {@link Vertex} values using the given {@link MapFunction}. * * @param translator implements conversion from {@code VV} to {@code NEW} * @param <NEW> new vertex value type * @return graph with translated vertex values * @throws Exception */ public <NEW> Graph<K, NEW, EV> translateVertexValues(TranslateFunction<VV, NEW> translator) throws Exception { return run(new TranslateVertexValues<>(translator)); }
Example #5
Source File: Graph.java From flink with Apache License 2.0 | 2 votes |
/** * Translate {@link Vertex} values using the given {@link MapFunction}. * * @param translator implements conversion from {@code VV} to {@code NEW} * @param <NEW> new vertex value type * @return graph with translated vertex values * @throws Exception */ public <NEW> Graph<K, NEW, EV> translateVertexValues(TranslateFunction<VV, NEW> translator) throws Exception { return run(new TranslateVertexValues<>(translator)); }
Example #6
Source File: Graph.java From flink with Apache License 2.0 | 2 votes |
/** * Translate {@link Vertex} values using the given {@link MapFunction}. * * @param translator implements conversion from {@code VV} to {@code NEW} * @param <NEW> new vertex value type * @return graph with translated vertex values * @throws Exception */ public <NEW> Graph<K, NEW, EV> translateVertexValues(TranslateFunction<VV, NEW> translator) throws Exception { return run(new TranslateVertexValues<>(translator)); }