/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.flink.graph.example.utils; import org.apache.flink.api.java.DataSet; import org.apache.flink.api.java.ExecutionEnvironment; import org.apache.flink.api.java.operators.DataSource; import org.apache.flink.graph.Edge; import org.apache.flink.graph.Vertex; import org.apache.flink.types.NullValue; import java.util.ArrayList; import java.util.List; public class SingleSourceShortestPathsDataUnweighted { public static final int NUM_VERTICES = 5; public static final Long SRC_VERTEX_ID = 1L; public static final String VERTICES = "1,1\n" + "2,2\n" + "3,3\n" + "4,4\n" + "5,5"; public static DataSet> getDefaultVertexDataSet(ExecutionEnvironment env) { List> vertices = new ArrayList>(); vertices.add(new Vertex(1L, 1L)); vertices.add(new Vertex(2L, 2L)); vertices.add(new Vertex(3L, 3L)); vertices.add(new Vertex(4L, 4L)); vertices.add(new Vertex(5L, 5L)); return env.fromCollection(vertices); } public static final String EDGES = "1,2\n" + "1,3\n" + "2,3\n" + "3,4\n" + "3,5\n" + "4,5\n" + "5,1"; public static final DataSource> getDefaultEdgeDataSet(ExecutionEnvironment env) { List> edges = new ArrayList>(); edges.add(new Edge(1L, 2L, NullValue.getInstance())); edges.add(new Edge(1L, 3L, NullValue.getInstance())); edges.add(new Edge(2L, 3L, NullValue.getInstance())); edges.add(new Edge(3L, 4L, NullValue.getInstance())); edges.add(new Edge(3L, 5L, NullValue.getInstance())); edges.add(new Edge(4L, 5L, NullValue.getInstance())); edges.add(new Edge(5L, 1L, NullValue.getInstance())); return env.fromCollection(edges); } public static final String RESULTED_SINGLE_SOURCE_SHORTEST_PATHS = "1,0\n" + "2,1\n" + "3,1\n" + "4,2\n" + "5,2"; private SingleSourceShortestPathsDataUnweighted() {} }