Package com.evelopers.unimod.glayout.graph

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


            super();
            this.v = v;
        }

        public int compare(Object o1, Object o2) {
            SimpleEdge e1   = (SimpleEdge) o1;
            SimpleEdge e2   = (SimpleEdge) o2;
            SimpleVertex v1 = e1.getAnother(v);
            SimpleVertex v2 = e2.getAnother(v);
            double x1       =
                Math.abs(v1.getVertexext().getLeftTop().getX()
                         - v.getVertexext().getLeftTop().getX());
            double x2 =
                Math.abs(v2.getVertexext().getLeftTop().getX()
View Full Code Here


        for1.setProperty(ISOLD_KEY, Boolean.TRUE);

        int n = sg.getVertices()
                  .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()
                                    .listIterator();
                LinkedList templl = new LinkedList();

                while (lie.hasNext()) {
                    templl.addLast(sv);
                    anEdge     = (SimpleEdge) lie.next();
                    sv         = anEdge.getAnother(sv);
                }

                while (!templl.isEmpty()) {
                    ll.addLast(templl.removeLast());
                }
View Full Code Here

            li = sv.getEdges()
                   .listIterator();
        }

        while (li.hasNext()) {
            SimpleEdge element = (SimpleEdge) li.next();
            SimpleVertex svc   = element.getAnother(sv);

            if ((sg.getVertices()
                       .indexOf(sv) != -1) && (sg.getVertices()
                                                     .indexOf(svc) != -1)
                    && (sg.getEdges()
View Full Code Here

    private Path pathFind(SimpleVertex sv) {
        // Shimon Even - Graph Algorithms - p 181
        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

            li = current.getEdges()
                        .listIterator();
        }

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

            if (sg.getEdges()
                      .indexOf(element) != -1) {
                SimpleVertex svc = element.getAnother(current);

                if ((svc == target) && (ac.getEdges()
                                              .indexOf(element) == -1)) {
                    ac.addEdge(element);
                    ac.addVertex(svc);
View Full Code Here

     */
    public SimpleEdge getMedianEdge13(SimpleVertex v, List edges) {
        ListIterator li = edges.listIterator();

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

            // median for deg == 1
            if ((v.getLeft()
                      .getEdges()
                      .indexOf(element) != -1)
View Full Code Here

                sv[i].setOrthY(vnums[i][1]);
            }
        }

        for (int i = 0; i < se.length; i++) {
            se[i] = new SimpleEdge(sv[enums[i][0]], sv[enums[i][1]]);
        }

        sg.addEdges(Arrays.asList(se));
        sg.addVertices(Arrays.asList(sv));
View Full Code Here

            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;
View Full Code Here

    public static boolean haveCommonEdges(Path p1, Path p2) {
        ListIterator li = p1.getEdges()
                            .listIterator();

        while (li.hasNext()) {
            SimpleEdge element1 = (SimpleEdge) li.next();
            ListIterator li2    = p2.getEdges()
                                    .listIterator();

            while (li2.hasNext()) {
                SimpleEdge element2 = (SimpleEdge) li2.next();

                if (element1.equals(element2)) {
                    return true;
                }
            }
View Full Code Here

    public void parameterizedTopSort(double weight, double startnum) {
        ListIterator li = sg.getEdges()
                            .listIterator();

        while (li.hasNext()) {
            SimpleEdge element = (SimpleEdge) li.next();
            element.setWeight(weight);
        }

        weightedTopSort(startnum);
    }
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.