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