Search in sources :

Example 31 with LNode

use of org.eclipse.elk.alg.layered.graph.LNode in project elk by eclipse.

the class TestGraphCreator method getInLayerEdgesGraph.

/**
 * <pre>
 *   --*
 *   |
 * *-+-*-*
 *   |
 *   --*
 * .
 * </pre>
 *
 * @return graph of the form above
 */
public LGraph getInLayerEdgesGraph() {
    Layer leftLayer = makeLayer();
    Layer middleLayer = makeLayer();
    Layer rightLayer = makeLayer();
    LNode leftNode = addNodeToLayer(leftLayer);
    LNode[] middleNodes = addNodesToLayer(3, middleLayer);
    LNode rightNode = addNodeToLayer(rightLayer);
    // add east side ports first to get expected port ordering
    eastWestEdgeFromTo(middleNodes[1], rightNode);
    eastWestEdgeFromTo(leftNode, middleNodes[1]);
    addInLayerEdge(middleNodes[0], middleNodes[2], PortSide.WEST);
    setUpIds();
    return graph;
}
Also used : LNode(org.eclipse.elk.alg.layered.graph.LNode) Layer(org.eclipse.elk.alg.layered.graph.Layer)

Example 32 with LNode

use of org.eclipse.elk.alg.layered.graph.LNode in project elk by eclipse.

the class TestGraphCreator method getOnlyCorrectlyImprovedByBestOfForwardAndBackwardSweepsInSingleLayer.

/**
 * <pre>
 * ___
 * | |\    *
 * | |\\  /
 * |_|-++-+*
 *     || \
 *     ====*
 * </pre>
 *
 * left Node has fixed Port Order.
 *
 * @return Graph of the form above.
 */
public LGraph getOnlyCorrectlyImprovedByBestOfForwardAndBackwardSweepsInSingleLayer() {
    LNode leftNode = addNodeToLayer(makeLayer());
    setFixedOrderConstraint(leftNode);
    LNode[] rightNodes = addNodesToLayer(3, makeLayer());
    eastWestEdgeFromTo(leftNode, rightNodes[2]);
    eastWestEdgeFromTo(leftNode, rightNodes[2]);
    eastWestEdgeFromTo(leftNode, rightNodes[1]);
    addInLayerEdge(rightNodes[0], rightNodes[2], PortSide.WEST);
    setUpIds();
    return graph;
}
Also used : LNode(org.eclipse.elk.alg.layered.graph.LNode)

Example 33 with LNode

use of org.eclipse.elk.alg.layered.graph.LNode in project elk by eclipse.

the class TestGraphCreator method getCrossFormedGraphConstraintsPreventAnySwitch.

/**
 * <pre>
 * this node must be.. -> *  *  <- and this node must be ...
 *                         \/
 *                         /\
 *    before this node -> *  *  <- before this node.
 * .
 * </pre>
 *
 * @return Graph of the form above.
 */
public LGraph getCrossFormedGraphConstraintsPreventAnySwitch() {
    Layer leftLayer = makeLayer();
    Layer rightLayer = makeLayer();
    LNode topLeft = addNodeToLayer(leftLayer);
    LNode bottomLeft = addNodeToLayer(leftLayer);
    LNode topRight = addNodeToLayer(rightLayer);
    LNode bottomRight = addNodeToLayer(rightLayer);
    eastWestEdgeFromTo(topLeft, bottomRight);
    eastWestEdgeFromTo(bottomLeft, topRight);
    setInLayerOrderConstraint(topRight, bottomRight);
    setInLayerOrderConstraint(topLeft, bottomLeft);
    setUpIds();
    return graph;
}
Also used : LNode(org.eclipse.elk.alg.layered.graph.LNode) Layer(org.eclipse.elk.alg.layered.graph.Layer)

Example 34 with LNode

use of org.eclipse.elk.alg.layered.graph.LNode in project elk by eclipse.

the class TestGraphCreator method getCrossWithManySelfLoopsGraph.

/**
 * Cross formed graph, but each node has three extra self loop edges.
 *
 * <pre>
 * *  *
 *  \/
 *  /\
 * *  *
 * .
 * </pre>
 *
 * @return Graph of the form above.
 */
public LGraph getCrossWithManySelfLoopsGraph() {
    LGraph selfLoopCrossGraph = getCrossFormedGraph();
    for (Layer layer : selfLoopCrossGraph) {
        for (LNode node : layer) {
            selfLoopOn(node, PortSide.EAST);
            selfLoopOn(node, PortSide.EAST);
            selfLoopOn(node, PortSide.EAST);
            selfLoopOn(node, PortSide.WEST);
            selfLoopOn(node, PortSide.WEST);
            selfLoopOn(node, PortSide.WEST);
        }
    }
    return selfLoopCrossGraph;
}
Also used : LNode(org.eclipse.elk.alg.layered.graph.LNode) LGraph(org.eclipse.elk.alg.layered.graph.LGraph) Layer(org.eclipse.elk.alg.layered.graph.Layer)

Example 35 with LNode

use of org.eclipse.elk.alg.layered.graph.LNode in project elk by eclipse.

the class TestGraphCreator method multipleEdgesAndSingleEdge.

/**
 * <pre>
 * *
 *  \\
 *   \\
 * *---*
 * .
 * </pre>
 *
 * @return Graph of the form above.
 */
public LGraph multipleEdgesAndSingleEdge() {
    Layer leftLayer = makeLayer();
    Layer rightLayer = makeLayer();
    LNode topLeft = addNodeToLayer(leftLayer);
    LNode bottomLeft = addNodeToLayer(leftLayer);
    LNode bottomRight = addNodeToLayer(rightLayer);
    eastWestEdgeFromTo(topLeft, bottomRight);
    eastWestEdgeFromTo(topLeft, bottomRight);
    eastWestEdgeFromTo(bottomLeft, bottomRight);
    setUpIds();
    return graph;
}
Also used : LNode(org.eclipse.elk.alg.layered.graph.LNode) Layer(org.eclipse.elk.alg.layered.graph.Layer)

Aggregations

LNode (org.eclipse.elk.alg.layered.graph.LNode)471 LPort (org.eclipse.elk.alg.layered.graph.LPort)189 Layer (org.eclipse.elk.alg.layered.graph.Layer)185 LEdge (org.eclipse.elk.alg.layered.graph.LEdge)110 LGraph (org.eclipse.elk.alg.layered.graph.LGraph)91 Test (org.junit.Test)85 KVector (org.eclipse.elk.core.math.KVector)38 PortSide (org.eclipse.elk.core.options.PortSide)28 List (java.util.List)23 LLabel (org.eclipse.elk.alg.layered.graph.LLabel)22 GraphInfoHolder (org.eclipse.elk.alg.layered.p3order.GraphInfoHolder)16 TestAfterProcessor (org.eclipse.elk.alg.test.framework.annotations.TestAfterProcessor)16 KVectorChain (org.eclipse.elk.core.math.KVectorChain)15 NodeType (org.eclipse.elk.alg.layered.graph.LNode.NodeType)14 ArrayList (java.util.ArrayList)13 InternalProperties (org.eclipse.elk.alg.layered.options.InternalProperties)13 LayeredOptions (org.eclipse.elk.alg.layered.options.LayeredOptions)13 PortConstraints (org.eclipse.elk.core.options.PortConstraints)13 Set (java.util.Set)12 CrossingsCounter (org.eclipse.elk.alg.layered.p3order.counting.CrossingsCounter)10