Search in sources :

Example 1 with LVertexFlattener

use of org.gradoop.flink.model.impl.operators.layouting.functions.LVertexFlattener in project gradoop by dbs-leipzig.

the class FusingFRLayouter method buildPostLayoutGraph.

/**
 * Extract all subverties/subedges from the super-vertices/super-edges and place them at the
 * location of the super-vertex (and add some random jitter to the positions).
 * Then some more layouting-iteraions are performed.
 *
 * @param input Original input graph
 * @param graph Result of the layouting
 * @return The final graph, containing all vertices and edges from the original graph.
 */
protected LogicalGraph buildPostLayoutGraph(LogicalGraph input, LGraph graph) {
    DataSet<LVertex> vertices = graph.getVertices().flatMap(new LVertexFlattener(true, getK()));
    DataSet<LEdge> edges = input.getEdges().map(LEdge::new);
    graph.setEdges(edges);
    // use a new applicator for all following layouting iterations. The new applicator will
    // behave as if iteration x of n is actually iterations+x of n+POST_ITERATIONS
    applicator = new FRForceApplicator(getWidth(), getHeight(), getK(), iterations + POST_ITERATIONS);
    applicator.setPreviousIterations(iterations);
    // do some more layouting iterations
    IterativeDataSet<LVertex> loop = vertices.iterate(POST_ITERATIONS);
    graph.setVertices(loop);
    layout(graph);
    vertices = loop.closeWith(graph.getVertices());
    DataSet<EPGMVertex> gradoopVertices = vertices.join(input.getVertices()).where(LVertex.ID_POSITION).equalTo("id").with(new LVertexEPGMVertexJoinFunction());
    return input.getFactory().fromDataSets(gradoopVertices, input.getEdges());
}
Also used : EPGMVertex(org.gradoop.common.model.impl.pojo.EPGMVertex) LVertexEPGMVertexJoinFunction(org.gradoop.flink.model.impl.operators.layouting.functions.LVertexEPGMVertexJoinFunction) LEdge(org.gradoop.flink.model.impl.operators.layouting.util.LEdge) LVertexFlattener(org.gradoop.flink.model.impl.operators.layouting.functions.LVertexFlattener) FRForceApplicator(org.gradoop.flink.model.impl.operators.layouting.functions.FRForceApplicator) LVertex(org.gradoop.flink.model.impl.operators.layouting.util.LVertex)

Aggregations

EPGMVertex (org.gradoop.common.model.impl.pojo.EPGMVertex)1 FRForceApplicator (org.gradoop.flink.model.impl.operators.layouting.functions.FRForceApplicator)1 LVertexEPGMVertexJoinFunction (org.gradoop.flink.model.impl.operators.layouting.functions.LVertexEPGMVertexJoinFunction)1 LVertexFlattener (org.gradoop.flink.model.impl.operators.layouting.functions.LVertexFlattener)1 LEdge (org.gradoop.flink.model.impl.operators.layouting.util.LEdge)1 LVertex (org.gradoop.flink.model.impl.operators.layouting.util.LVertex)1