Package com.evelopers.unimod.glayout.graph

Examples of com.evelopers.unimod.glayout.graph.SimpleEdge


        SimpleVertex test1 = (SimpleVertex) sg.getVertices()
                                              .get(3);
        SimpleVertex test2 = (SimpleVertex) sg1.getVertices()
                                               .get(0);
        SimpleEdge e = new SimpleEdge(test2, test1);
        sg.addEdge(e);

        long time = System.currentTimeMillis();

        MultiLayerLayouter.layout(sg);
View Full Code Here


        }

        g.removePropertyAsc(COMP_KEY);

        for (int i = 0; i < (count - 1); i++) {
            SimpleEdge e = new SimpleEdge(arr[i], arr[i + 1]);
            e.setProperty(FICTIVEEDGECONN_KEY, FICTIVEVALUE);
            g.addEdge(e);
        }
    }
View Full Code Here

        SimpleVertex vprev = (SimpleVertex) li2c.next();

        while (li2c.hasNext()) {
            SimpleVertex vnext = (SimpleVertex) li2c.next();

            SimpleEdge e = new SimpleEdge(vprev, vnext);
            e.setProperty(FICTIVEEDGEBICONN_KEY, FICTIVEVALUE);
            sg.addEdge(e);

            vprev = vnext;
        }
    }
View Full Code Here

        int esub_count   = 0;
        ListIterator lie = sg.getEdges()
                             .listIterator();

        while (lie.hasNext()) {
            SimpleEdge element = (SimpleEdge) lie.next();
            int esub_n         = element.getIntProperty(ESUBGRAPH_KEY);

            if (esub_n > esub_count) {
                esub_count = esub_n;
            }
        }

        // creating vertices
        SimpleVertex[] white = new SimpleVertex[esub_count];

        for (int i = 0; i < white.length; i++) {
            white[i] = new SimpleVertex();
            blk.addVertex(white[i]);
        }

        // setting vertex corresp
        lie = sg.getEdges()
                .listIterator();

        while (lie.hasNext()) {
            SimpleEdge element  = (SimpleEdge) lie.next();
            SimpleVertex svcomp = white[element.getIntProperty(ESUBGRAPH_KEY) - 1];
            SimpleVertex v1     = element.getSource();
            SimpleVertex v2     = element.getTarget();

            //setting corresp vertex not from cutpoints
            if ((svcomp.getVertexProperty(CORRESP_KEY) == null)
                    || (!cutpoints.contains(v1))) {
                svcomp.setProperty(CORRESP_KEY, v1);
            }

            if ((svcomp.getVertexProperty(CORRESP_KEY) == null)
                    || (!cutpoints.contains(v2))) {
                svcomp.setProperty(CORRESP_KEY, v2);
            }
        }

        // adding edges
        licp = cutpoints.listIterator();

        while (licp.hasNext()) {
            SimpleVertex element = (SimpleVertex) licp.next();
            SimpleVertex svcutp  = element.getVertexProperty(CORRESP_KEY);
            ListIterator liedges = element.getEdgesRelative(sg)
                                          .listIterator();

            List v2c = new ArrayList();

            // but no duplicate edges
            while (liedges.hasNext()) {
                SimpleEdge edge     = (SimpleEdge) liedges.next();
                SimpleVertex svcomp = white[edge.getIntProperty(ESUBGRAPH_KEY) - 1];

                if (!v2c.contains(svcomp)) {
                    v2c.add(svcomp);
                }
            }

            ListIterator liv2c = v2c.listIterator();

            while (liv2c.hasNext()) {
                SimpleVertex vertex = (SimpleVertex) liv2c.next();

                SimpleEdge toadd = new SimpleEdge(svcutp, vertex);
                blk.addEdge(toadd);
            }
        }

        sg.removePropertyAsc(CORRESP_KEY);
View Full Code Here

        // maybe without startV
        List connectedVertices = sg.getVertices();
        SimpleVertex tempV;
        SimpleVertex otherV;
        SimpleEdge tempE;
        int i                  = 0;
        List edges;
        boolean flag;
        boolean hasUnusedEdges;
        boolean alreadyVisited = false;
        int subGraphNumber     = 1;
        LinkedList nodeStack   = new LinkedList();
        LinkedList edgeStack   = new LinkedList();

        ListIterator li = connectedVertices.listIterator();

        while (li.hasNext()) {
            SimpleVertex v = (SimpleVertex) li.next();
            v.setProperty(DFSNUM_KEY,
                          new Integer(0));
            v.setProperty(ISOLD_KEY, Boolean.FALSE);
            v.setProperty(LOWNUM_KEY,
                          new Integer(0));
            v.setProperty(SUBGRAPH_KEY,
                          new Integer(0));
        }

        edges     = sg.getEdges();
        li        = edges.listIterator();

        while (li.hasNext()) {
            SimpleEdge e = (SimpleEdge) li.next();
            e.setProperty(ISUSED_KEY, Boolean.FALSE);
            e.setProperty(ESUBGRAPH_KEY,
                          new Integer(0));
            e.setProperty(WASADDED_KEY, Boolean.FALSE);
        }

        tempV = (SimpleVertex) connectedVertices.get(0);

        do {
            if (!alreadyVisited) {
                i++;
                tempV.setProperty(DFSNUM_KEY,
                                  new Integer(i));
                tempV.setProperty(LOWNUM_KEY,
                                  new Integer(i));
                nodeStack.addLast(tempV);
            }

            li     = tempV.getEdgesRelative(sg)
                          .listIterator();
            flag               = false;
            hasUnusedEdges     = false;
            alreadyVisited     = false;

            while (li.hasNext()) {
                tempE = (SimpleEdge) li.next();

                if (!tempE.getBooleanProperty(ISUSED_KEY)) {
                    tempE.setProperty(ISUSED_KEY, Boolean.TRUE);
                    tempE.setProperty(WASADDED_KEY, Boolean.TRUE);
                    edgeStack.addLast(tempE);
                    hasUnusedEdges     = true;
                    otherV             = tempE.getAnother(tempV);

                    if (otherV.getIntProperty(DFSNUM_KEY) == 0) {
                        otherV.setProperty(PARENT_KEY, tempV);
                        tempV = otherV;
                    } else {
                        tempV.setProperty(LOWNUM_KEY,
                                          new Integer(Math.min(
                                                               tempV.getIntProperty(LOWNUM_KEY),
                                                               otherV.getIntProperty(DFSNUM_KEY))));
                        alreadyVisited = true;
                    }

                    break;
                }
            }

            if (!hasUnusedEdges) {
                if (tempV.getVertexProperty(PARENT_KEY)
                             .getIntProperty(DFSNUM_KEY) != 1) {
                    if (tempV.getIntProperty(LOWNUM_KEY) < tempV.getVertexProperty(PARENT_KEY)
                                                                    .getIntProperty(DFSNUM_KEY)) {
                        tempV.getVertexProperty(PARENT_KEY)
                             .setProperty(LOWNUM_KEY,
                                          new Integer(Math.min(
                                                               tempV.getVertexProperty(PARENT_KEY).getIntProperty(LOWNUM_KEY),
                                                               tempV.getIntProperty(LOWNUM_KEY))));
                    } else {
                        while (nodeStack.getLast() != tempV) {
                            ((SimpleVertex) nodeStack.removeLast()).setProperty(SUBGRAPH_KEY,
                                                                                new Integer(subGraphNumber));
                        }

                        if (nodeStack.getLast() == tempV) {
                            ((SimpleVertex) nodeStack.removeLast()).setProperty(SUBGRAPH_KEY,
                                                                                new Integer(subGraphNumber));
                        }

                        while (((SimpleEdge) edgeStack.getLast()).getAnother(tempV) != tempV
                                                                                           .getVertexProperty(PARENT_KEY)) {
                            tempE = (SimpleEdge) edgeStack.removeLast();
                            tempE.setProperty(WASADDED_KEY,
                                              Boolean.valueOf(false));
                            tempE.setProperty(ESUBGRAPH_KEY,
                                              new Integer(subGraphNumber));
                        }

                        if (((SimpleEdge) edgeStack.getLast()).getAnother(tempV) == tempV
                                                                                        .getVertexProperty(PARENT_KEY)) {
                            tempE = (SimpleEdge) edgeStack.removeLast();
                            tempE.setProperty(WASADDED_KEY,
                                              Boolean.valueOf(false));
                            tempE.setProperty(ESUBGRAPH_KEY,
                                              new Integer(subGraphNumber));
                        }

                        subGraphNumber++;

                        if ((tempV.getVertexProperty(PARENT_KEY) == null)
                                || !(tempV.getVertexProperty(PARENT_KEY).getBooleanProperty(ISOLD_KEY))) {
                            tempV.getVertexProperty(PARENT_KEY)
                                 .setProperty(SUBGRAPH_KEY,
                                              new Integer(0));
                            tempV.getVertexProperty(PARENT_KEY)
                                 .setProperty(ISOLD_KEY,
                                              Boolean.valueOf(true));
                            separatingVertices.add(tempV.getVertexProperty(PARENT_KEY));
                        }
                    }

                    tempV              = tempV.getVertexProperty(PARENT_KEY);
                    alreadyVisited     = true;
                    flag               = true;
                }

                if (!flag) {
                    while (nodeStack.getLast() != tempV) {
                        ((SimpleVertex) nodeStack.removeLast()).setProperty(SUBGRAPH_KEY,
                                                                            new Integer(subGraphNumber));
                    }

                    if (nodeStack.getLast() == tempV) {
                        ((SimpleVertex) nodeStack.removeLast()).setProperty(SUBGRAPH_KEY,
                                                                            new Integer(subGraphNumber));
                    }

                    ((SimpleVertex) connectedVertices.get(0)).setProperty(SUBGRAPH_KEY,
                                                                          new Integer(subGraphNumber));
                    ;

                    while (((SimpleEdge) edgeStack.getLast()).getAnother(tempV) != (SimpleVertex) connectedVertices
                                                                                       .get(0)) {
                        tempE = (SimpleEdge) edgeStack.removeLast();
                        tempE.setProperty(WASADDED_KEY,
                                          Boolean.valueOf(false));
                        tempE.setProperty(ESUBGRAPH_KEY,
                                          new Integer(subGraphNumber));
                    }

                    if (((SimpleEdge) edgeStack.getLast()).getAnother(tempV) == (SimpleVertex) connectedVertices
                                                                                    .get(0)) {
                        tempE = (SimpleEdge) edgeStack.removeLast();
                        tempE.setProperty(WASADDED_KEY,
                                          Boolean.valueOf(false));
                        tempE.setProperty(ESUBGRAPH_KEY,
                                          new Integer(subGraphNumber));
                    }

                    subGraphNumber++;

                    ListIterator enum2 =
                        ((SimpleVertex) connectedVertices
                         .get(0)).getEdgesRelative(sg)
                         .listIterator();
                    boolean flag2 = false;

                    while (enum2.hasNext()) {
                        SimpleEdge element = (SimpleEdge) enum2.next();

                        if (!element.getBooleanProperty(ISUSED_KEY)) {
                            flag2 = true;
                        }
                    }

                    if (!flag2) {
View Full Code Here

        li = sg.getEdges()
               .listIterator();

        while (li.hasNext()) {
            SimpleEdge e = (SimpleEdge) li.next();
            bg.setColor(Consts.EDGE_C);

            if ((e.getProperty(Connectivity.FICTIVEEDGEBICONN_KEY) != null)
                    || (e.getProperty(Connectivity.FICTIVEEDGECONN_KEY) != null)
                    || (e.getProperty(AltMultiLayerBuilder.FICTIVEML_KEY) != null)
                    || (e.getProperty(AltMultiLayerBuilder.FICTIVEMLE_KEY) != null)) {
                bg.setColor(Color.GREEN);
            }

            int[] xpoints     = new int[3];
            int[] ypoints     = new int[3];
            SimpleVertex src  = e.getSource();
            SimpleVertex dest = e.getTarget();
            Anchor srca       = e.getEdgeext()
                                 .getSrcAnchor();
            Anchor targeta = e.getEdgeext()
                              .getTargetAnchor();

            Point2D spoint = src.getVertexext()
                                .getAnchorPoint(srca);
View Full Code Here

                ListIterator outg =
                    element.getEdgesRelativeOutgoing(getGraph())
                           .listIterator();

                while (outg.hasNext()) {
                    SimpleEdge outg_e = (SimpleEdge) outg.next();

                    if (outg_e.getLeft() == vfaces[0]) {
                        islefted = true;

                        break;
                    }
                }
View Full Code Here

        ListIterator li = getGraph()
                              .getEdges()
                              .listIterator();

        while (li.hasNext()) {
            SimpleEdge element = (SimpleEdge) li.next();
            element.setOrig(InvestigatorHelper.countOrig(element));
            element.setDest(InvestigatorHelper.countDest(element));
        }
    }
View Full Code Here

        ListIterator li = gd.getOuterLeft()
                            .getEdges()
                            .listIterator();

        while (li.hasNext()) {
            SimpleEdge element = (SimpleEdge) li.next();
            element.setLeft(gd.getOuterLeft());
            workingedges.addLast(element);
        }

        while (workingedges.size() > 0) {
            SimpleEdge working = (SimpleEdge) workingedges.removeFirst();
            Face eface         = InvestigatorHelper.getFaceForEdge(gd, working, this);

            if (eface != null) {
                eface.setProperty(this, TEMP_VALUE);
View Full Code Here

        ListIterator lie = sg.getEdges()
                             .listIterator();

        while (lie.hasNext()) {
            SimpleEdge element = (SimpleEdge) lie.next();

            if (!((element.getSource() == gd.getSource())
                    && (element.getTarget() == gd.getTarget()))) {
                SimpleVertex src = element.getLeft()
                                          .getVertexProperty(this);
                SimpleVertex dst = element.getRight()
                                          .getVertexProperty(this);
                SimpleEdge se = new SimpleEdge(src, dst);
                associated.addEdge(se);
            }
        }
    }
View Full Code Here

TOP

Related Classes of com.evelopers.unimod.glayout.graph.SimpleEdge

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.