Package com.evelopers.unimod.glayout.graph

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


        ListIterator li = sg.getVertices()
                            .listIterator();
        int i = 0;

        while (li.hasNext()) {
            SimpleVertex element = (SimpleVertex) li.next();

            if (element.getProperty(o) == null) {
                dfsFill(sg,
                        element,
                        o,
                        new Integer(i),
                        hv);
View Full Code Here


                  .size();
        int i             = 1;
        SimpleEdge anEdge;

        while (true) {
            SimpleVertex sv = (SimpleVertex) ll.removeLast();

            if (sv == dst) {
                sv.setProperty(STNUM_KEY,
                               new Integer(n));
                nodesInStOrder.addLast(sv);

                break;
            }

            Path p = pathFind(sv);

            if (p.getEdges()
                     .size() == 0) {
                sv.setProperty(STNUM_KEY,
                               new Integer(i));
                nodesInStOrder.addLast(sv);
                i++;
            } else {
                ListIterator lie = p.getEdges()
View Full Code Here

        Path path            = new Path(sg);
        List lEdges;
        List lEdges2;
        SimpleEdge anEdge;
        SimpleEdge tempEdge;
        SimpleVertex aVertex;

        // case 1
        lEdges = sv.getEdgesRelative(sg);

        ListIterator lie = lEdges.listIterator();

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

            if (!anEdge.getBooleanProperty(ISOLD_KEY)
                    && anEdge.getBooleanProperty(ISBACKEDGE_KEY)
                    && ((anEdge.getAnother(sv)).getIntProperty(DFSNUM_KEY) < sv
                                                                                 .getIntProperty(DFSNUM_KEY))) {
                anEdge.setProperty(ISOLD_KEY, Boolean.TRUE);
                path.addEdge(anEdge);

                return path;
            }
        }

        // case 2
        lEdges     = sv.getEdgesRelative(sg);
        lie        = lEdges.listIterator();

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

            if (!anEdge.getBooleanProperty(ISOLD_KEY)
                    && !anEdge.getBooleanProperty(ISBACKEDGE_KEY)
                    && (anEdge.getAnother(sv)
                                  .getVertexProperty(PARENT_KEY) == sv)
                    && (anEdge.getAnother(sv)
                                  .getIntProperty(DFSNUM_KEY) > sv.getIntProperty(DFSNUM_KEY))) {
                anEdge.setProperty(ISOLD_KEY, Boolean.TRUE);
                path.addEdge(anEdge);
                aVertex = anEdge.getAnother(sv);

                boolean found;

                while (!aVertex.getBooleanProperty(ISOLD_KEY)) {
                    lEdges2     = aVertex.getEdgesRelative(sg);
                    found       = false;

                    ListIterator lie2 = lEdges2.listIterator();

                    while (lie2.hasNext()) {
                        tempEdge = (SimpleEdge) lie2.next();

                        if (!tempEdge.getBooleanProperty(ISOLD_KEY)
                                && ((tempEdge.getAnother(aVertex)).getIntProperty(DFSNUM_KEY) == aVertex
                                                                                                     .getIntProperty(LOWNUM_KEY))) {
                            aVertex.setProperty(ISOLD_KEY, Boolean.TRUE);
                            tempEdge.setProperty(ISOLD_KEY, Boolean.TRUE);
                            path.addEdge(tempEdge);
                            found = true;

                            break;
                        }
                    }

                    if (!found) {
                        lEdges2     = aVertex.getEdgesRelative(sg);
                        lie2        = lEdges2.listIterator();

                        while (lie2.hasNext()) {
                            tempEdge = (SimpleEdge) lie2.next();

                            if (!tempEdge.getBooleanProperty(ISOLD_KEY)
                                    && (tempEdge.getAnother(aVertex)
                                                    .getVertexProperty(PARENT_KEY) == aVertex)
                                    && (tempEdge.getAnother(aVertex)
                                                    .getIntProperty(LOWNUM_KEY) == aVertex
                                                                                       .getIntProperty(LOWNUM_KEY))) {
                                aVertex.setProperty(ISOLD_KEY, Boolean.TRUE);
                                tempEdge.setProperty(ISOLD_KEY, Boolean.TRUE);
                                path.addEdge(tempEdge);
                                aVertex = tempEdge.getAnother(aVertex);

                                break;
                            }
                        }
                    }
                }

                return path;
            }
        }

        // case 3
        lEdges     = sv.getEdgesRelative(sg);
        lie        = lEdges.listIterator();

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

            if (!anEdge.getBooleanProperty(ISOLD_KEY)
                    && anEdge.getBooleanProperty(ISBACKEDGE_KEY)
                    && (anEdge.getAnother(sv)
                                  .getIntProperty(DFSNUM_KEY) > sv.getIntProperty(DFSNUM_KEY))) {
                anEdge.setProperty(ISOLD_KEY, Boolean.TRUE);
                path.addEdge(anEdge);
                aVertex = anEdge.getAnother(sv);

                while (!aVertex.getBooleanProperty(ISOLD_KEY)) {
                    lEdges2 = aVertex.getEdgesRelative(sg);

                    ListIterator lie2 = lEdges2.listIterator();

                    while (lie2.hasNext()) {
                        tempEdge = (SimpleEdge) lie2.next();

                        if (!tempEdge.getBooleanProperty(ISOLD_KEY)
                                && ((tempEdge.getAnother(aVertex)) == aVertex
                                                                          .getVertexProperty(PARENT_KEY))) {
                            aVertex.setProperty(ISOLD_KEY, Boolean.TRUE);
                            tempEdge.setProperty(ISOLD_KEY, Boolean.TRUE);
                            path.addEdge(tempEdge);
                            aVertex = tempEdge.getAnother(aVertex);

                            break;
View Full Code Here

        int i                  = 0;
        boolean flag;
        boolean hasUnusedEdges;
        boolean alreadyVisited = false;

        SimpleVertex temp = dst;
        Associatable.putLProperty(sg.getEdges(),
                                  ISUSED_KEY,
                                  Boolean.FALSE);
        Associatable.putLProperty(sg.getEdges(),
                                  ISBACKEDGE_KEY,
                                  Boolean.FALSE);
        Associatable.putLProperty(sg.getVertices(),
                                  DFSNUM_KEY,
                                  new Integer(0));
        Associatable.putLProperty(sg.getVertices(),
                                  LOWNUM_KEY,
                                  new Integer(0));

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

            if (temp == dst) {
                incv = new ArrayList();
                incv.addAll(temp.getEdgesRelative(sg));
                incv.remove(te);
                incv.add(0, te);
            } else {
                incv = temp.getEdgesRelative(sg);
            }

            flag               = false;
            hasUnusedEdges     = false;
            alreadyVisited     = false;

            ListIterator li    = incv.listIterator();

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

                if (!tempEdge.getBooleanProperty(ISUSED_KEY)) {
                    tempEdge.setProperty(ISUSED_KEY, Boolean.TRUE);
                    hasUnusedEdges = true;

                    SimpleVertex otherVertex = tempEdge.getAnother(temp);

                    // null instead of zero
                    if (otherVertex.getIntProperty(DFSNUM_KEY) == 0) {
                        tempEdge.setProperty(ISBACKEDGE_KEY, Boolean.FALSE);
                        otherVertex.setProperty(PARENT_KEY, temp);
                        temp = otherVertex;
                    } else {
                        tempEdge.setProperty(ISBACKEDGE_KEY, Boolean.TRUE);
                        temp.setProperty(LOWNUM_KEY,
                                         new Integer(Math.min(
                                                              temp.getIntProperty(LOWNUM_KEY),
                                                              otherVertex.getIntProperty(DFSNUM_KEY))));
                        alreadyVisited = true;
                    }

                    break;
                }
View Full Code Here

        topSort(ll, sourcenum);

        ListIterator li = ll.listIterator();

        while (li.hasNext()) {
            SimpleVertex element = (SimpleVertex) li.next();
            ListIterator li2     = element.getEdgesOutgoing()
                                          .listIterator();

            while (li2.hasNext()) {
                SimpleEdge edge = (SimpleEdge) li2.next();
                double delta    =
                    (0.0 + edge.getAnother(element)
                               .getTopnum()) - edge.getWeight() - element.getTopnum();

                if (delta < 0) {
                    int step = (int) Math.floor(-delta);
                    updateList(ll,
                               step,
View Full Code Here

     */
    private void updateList(LinkedList ll, int step, int start) {
        ListIterator li = ll.listIterator(start);

        while (li.hasNext()) {
            SimpleVertex element = (SimpleVertex) li.next();
            element.setTopnum(element.getTopnum() + step);
        }
    }
View Full Code Here

    private void topSort(LinkedList ll, double sourcenum) {
        ListIterator li = sg.getVertices()
                            .listIterator();

        while (li.hasNext()) {
            SimpleVertex element = (SimpleVertex) li.next();

            if (element.getProperty(this) == null) {
                dfsvisit(element, ll);
            }
        }

        ListIterator topli = ll.listIterator();
        double startnum    = sourcenum;

        while (topli.hasNext()) {
            SimpleVertex element = (SimpleVertex) topli.next();
            element.setTopnum(startnum);
            startnum += 1.0;
        }

        sg.removePropertyAsc(this);
    }
View Full Code Here

        ListIterator li = sg.getVertices()
                            .listIterator();

        while (li.hasNext()) {
            SimpleVertex v = (SimpleVertex) li.next();

            if (BigVertex.isBig(v)) {
                bg.setColor(Consts.BIGVERTEX_C);
            } else {
                bg.setColor(Consts.VERTEX_C);
            }

            bg.fillOval(xconvert(v.getOrthX()) - (Consts.OVR / 2),
                        yconvert(v.getOrthY()) - (Consts.OVR / 2), Consts.OVR, Consts.OVR);
            bg.drawString("v" + v.getId(), xconvert(v.getOrthX()) + (Consts.VR / 2),
                          yconvert(v.getOrthY()) - (Consts.VR / 2));
        }

        li = sg.getEdges()
               .listIterator();
View Full Code Here

        double maxy     = Double.MIN_VALUE;
        ListIterator li = sg.getVertices()
                            .listIterator();

        while (li.hasNext()) {
            SimpleVertex element = (SimpleVertex) li.next();

            if (element.getOrthY() > maxy) {
                maxy = element.getOrthY();
            }

            if (element.getOrthX() > maxx) {
                maxx = element.getOrthX();
            }
        }

        ListIterator lie = sg.getEdges()
                             .listIterator();
View Full Code Here

TOP

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

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.