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