Search in sources :

Example 1 with GSASingleSourceShortestPaths

use of org.apache.flink.graph.library.GSASingleSourceShortestPaths in project flink by apache.

the class GatherSumApplyITCase method testSingleSourceShortestPaths.

// --------------------------------------------------------------------------------------------
//  Single Source Shortest Path Test
// --------------------------------------------------------------------------------------------
@Test
public void testSingleSourceShortestPaths() throws Exception {
    final ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
    Graph<Long, NullValue, Double> inputGraph = Graph.fromDataSet(SingleSourceShortestPathsData.getDefaultEdgeDataSet(env), new InitMapperSSSP(), env);
    List<Vertex<Long, Double>> result = inputGraph.run(new GSASingleSourceShortestPaths<Long, NullValue>(1L, 16)).collect();
    String expectedResult = "1,0.0\n" + "2,12.0\n" + "3,13.0\n" + "4,47.0\n" + "5,48.0\n";
    compareResultAsTuples(result, expectedResult);
}
Also used : GSASingleSourceShortestPaths(org.apache.flink.graph.library.GSASingleSourceShortestPaths) Vertex(org.apache.flink.graph.Vertex) ExecutionEnvironment(org.apache.flink.api.java.ExecutionEnvironment) NullValue(org.apache.flink.types.NullValue) Test(org.junit.Test)

Aggregations

ExecutionEnvironment (org.apache.flink.api.java.ExecutionEnvironment)1 Vertex (org.apache.flink.graph.Vertex)1 GSASingleSourceShortestPaths (org.apache.flink.graph.library.GSASingleSourceShortestPaths)1 NullValue (org.apache.flink.types.NullValue)1 Test (org.junit.Test)1