/** * 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} 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 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 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<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()); } }