Search in sources :

Example 36 with LNode

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

the class TestGraphCreator method getGraphNoCrossingsDueToPortOrderNotFixed.

/**
 * <pre>
 * ____  *
 * |  |\/
 * |__|/\
 *       *
 * .
 * </pre>
 *
 * Port order not fixed
 *
 * @return Graph of the form above.
 */
public LGraph getGraphNoCrossingsDueToPortOrderNotFixed() {
    Layer leftLayer = makeLayer();
    Layer rightLayer = makeLayer();
    LNode leftNode = addNodeToLayer(leftLayer);
    LNode rightTopNode = addNodeToLayer(rightLayer);
    LNode rightBottomNode = addNodeToLayer(rightLayer);
    eastWestEdgeFromTo(leftNode, rightBottomNode);
    eastWestEdgeFromTo(leftNode, rightTopNode);
    setUpIds();
    return graph;
}
Also used : LNode(org.eclipse.elk.alg.layered.graph.LNode) Layer(org.eclipse.elk.alg.layered.graph.Layer)

Example 37 with LNode

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

the class TestGraphCreator method twoEdgesIntoSamePortResolvesCrossingWhenSwitched.

/**
 * <pre>
 * *  *
 *  \/
 *  /\
 * *--*<- Into same port
 * </pre>
 *
 * .
 *
 * @return Graph of the form above.
 */
public LGraph twoEdgesIntoSamePortResolvesCrossingWhenSwitched() {
    Layer leftLayer = makeLayer();
    Layer rightLayer = makeLayer();
    LNode topLeft = addNodeToLayer(leftLayer);
    LNode bottomLeft = addNodeToLayer(leftLayer);
    LNode topRight = addNodeToLayer(rightLayer);
    LNode bottomRight = addNodeToLayer(rightLayer);
    LPort topLeftPort = addPortOnSide(topLeft, PortSide.EAST);
    LPort bottomLeftPort = addPortOnSide(bottomLeft, PortSide.EAST);
    LPort bottomRightPort = addPortOnSide(bottomRight, PortSide.WEST);
    addEdgeBetweenPorts(topLeftPort, bottomRightPort);
    addEdgeBetweenPorts(bottomLeftPort, bottomRightPort);
    eastWestEdgeFromTo(bottomLeft, topRight);
    setUpIds();
    return graph;
}
Also used : LPort(org.eclipse.elk.alg.layered.graph.LPort) LNode(org.eclipse.elk.alg.layered.graph.LNode) Layer(org.eclipse.elk.alg.layered.graph.Layer)

Example 38 with LNode

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

the class InLayerEdgeTestGraphCreator method getInLayerOneLayerNoCrossings.

/**
 * <pre>
 * |---*
 * |
 * | --*
 * | |
 * | --*
 *  \
 *   \
 *    \
 *     *
 * .
 * </pre>
 *
 * @return Graph of the form above.
 */
public LGraph getInLayerOneLayerNoCrossings() {
    Layer layer = makeLayer(getGraph());
    LNode[] nodes = addNodesToLayer(4, layer);
    addInLayerEdge(nodes[0], nodes[3], PortSide.WEST);
    addInLayerEdge(nodes[1], nodes[2], PortSide.WEST);
    return getGraph();
}
Also used : LNode(org.eclipse.elk.alg.layered.graph.LNode) Layer(org.eclipse.elk.alg.layered.graph.Layer)

Example 39 with LNode

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

the class InLayerEdgeTestGraphCreator method getInLayerEdgesWithFixedPortOrderAndNormalEdgeCrossings.

/**
 * <pre>
 *       ___
 *    ---| |
 *    |  | |  <- switch this
 * ---+--|_|
 * |  |
 * *--|--*  <- with this
 *    |
 *    ---*
 * .
 * </pre>
 *
 * With fixed Port PortOrder.
 *
 * @return Graph of the form above.
 */
public LGraph getInLayerEdgesWithFixedPortOrderAndNormalEdgeCrossings() {
    Layer[] layer = makeLayers(2);
    LNode leftNode = addNodeToLayer(layer[0]);
    LNode[] rightNodes = addNodesToLayer(3, layer[1]);
    setFixedOrderConstraint(rightNodes[0]);
    eastWestEdgeFromTo(leftNode, rightNodes[0]);
    addInLayerEdge(rightNodes[0], rightNodes[2], PortSide.WEST);
    eastWestEdgeFromTo(leftNode, rightNodes[1]);
    return getGraph();
}
Also used : LNode(org.eclipse.elk.alg.layered.graph.LNode) Layer(org.eclipse.elk.alg.layered.graph.Layer)

Example 40 with LNode

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

the class InLayerEdgeTestGraphCreator method getOneLayerWithInLayerCrossings.

/**
 * <pre>
 *   --*
 *   |
 *   |/*
 *  /|
 * | --*
 *  \
 *   \
 *    \
 *     *
 * .
 * </pre>
 *
 * @return Graph of the form above.
 */
public LGraph getOneLayerWithInLayerCrossings() {
    Layer layer = makeLayer(getGraph());
    LNode[] nodes = addNodesToLayer(4, layer);
    addInLayerEdge(nodes[0], nodes[2], PortSide.WEST);
    addInLayerEdge(nodes[1], nodes[3], PortSide.WEST);
    return getGraph();
}
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