/** * Translate {@link Vertex} IDs using the given {@link TranslateFunction}. * * @param vertices input vertices * @param translator implements conversion from {@code OLD} to {@code NEW} * @param <OLD> old vertex ID type * @param <NEW> new vertex ID type * @param <VV> vertex value type * @return translated vertices */ public static <OLD, NEW, VV> DataSet<Vertex<NEW, VV>> translateVertexIds(DataSet<Vertex<OLD, VV>> vertices, TranslateFunction<OLD, NEW> translator) { return translateVertexIds(vertices, translator, PARALLELISM_DEFAULT); }
@Override public Graph<NEW, VV, EV> runInternal(Graph<OLD, VV, EV> input) throws Exception { // Vertices DataSet<Vertex<NEW, VV>> translatedVertices = translateVertexIds(input.getVertices(), translator, parallelism); // Edges DataSet<Edge<NEW, EV>> translatedEdges = translateEdgeIds(input.getEdges(), translator, parallelism); // Graph return Graph.fromDataSet(translatedVertices, translatedEdges, input.getContext()); } }
/** * Translate {@link Vertex} IDs using the given {@link TranslateFunction}. * * @param vertices input vertices * @param translator implements conversion from {@code OLD} to {@code NEW} * @param <OLD> old vertex ID type * @param <NEW> new vertex ID type * @param <VV> vertex value type * @return translated vertices */ public static <OLD, NEW, VV> DataSet<Vertex<NEW, VV>> translateVertexIds(DataSet<Vertex<OLD, VV>> vertices, TranslateFunction<OLD, NEW> translator) { return translateVertexIds(vertices, translator, PARALLELISM_DEFAULT); }
/** * Translate {@link Vertex} IDs using the given {@link TranslateFunction}. * * @param vertices input vertices * @param translator implements conversion from {@code OLD} to {@code NEW} * @param <OLD> old vertex ID type * @param <NEW> new vertex ID type * @param <VV> vertex value type * @return translated vertices */ public static <OLD, NEW, VV> DataSet<Vertex<NEW, VV>> translateVertexIds(DataSet<Vertex<OLD, VV>> vertices, TranslateFunction<OLD, NEW> translator) { return translateVertexIds(vertices, translator, PARALLELISM_DEFAULT); }
/** * Translate {@link Vertex} IDs using the given {@link TranslateFunction}. * * @param vertices input vertices * @param translator implements conversion from {@code OLD} to {@code NEW} * @param <OLD> old vertex ID type * @param <NEW> new vertex ID type * @param <VV> vertex value type * @return translated vertices */ public static <OLD, NEW, VV> DataSet<Vertex<NEW, VV>> translateVertexIds(DataSet<Vertex<OLD, VV>> vertices, TranslateFunction<OLD, NEW> translator) { return translateVertexIds(vertices, translator, PARALLELISM_DEFAULT); }
@Override public Graph<NEW, VV, EV> runInternal(Graph<OLD, VV, EV> input) throws Exception { // Vertices DataSet<Vertex<NEW, VV>> translatedVertices = translateVertexIds(input.getVertices(), translator, parallelism); // Edges DataSet<Edge<NEW, EV>> translatedEdges = translateEdgeIds(input.getEdges(), translator, parallelism); // Graph return Graph.fromDataSet(translatedVertices, translatedEdges, input.getContext()); } }
@Override public Graph<NEW, VV, EV> runInternal(Graph<OLD, VV, EV> input) throws Exception { // Vertices DataSet<Vertex<NEW, VV>> translatedVertices = translateVertexIds(input.getVertices(), translator, parallelism); // Edges DataSet<Edge<NEW, EV>> translatedEdges = translateEdgeIds(input.getEdges(), translator, parallelism); // Graph return Graph.fromDataSet(translatedVertices, translatedEdges, input.getContext()); } }
@Override public Graph<NEW, VV, EV> runInternal(Graph<OLD, VV, EV> input) throws Exception { // Vertices DataSet<Vertex<NEW, VV>> translatedVertices = translateVertexIds(input.getVertices(), translator, parallelism); // Edges DataSet<Edge<NEW, EV>> translatedEdges = translateEdgeIds(input.getEdges(), translator, parallelism); // Graph return Graph.fromDataSet(translatedVertices, translatedEdges, input.getContext()); } }