Package javolution.util

Examples of javolution.util.FastSet


            B1.addAll(B4);

            B2 = B4;
        }

        Set<BipartiteNode<T>> leftClone = new FastSet(U);
        Set<BipartiteNode<T>> rightClone = new FastSet(V);

        leftClone.removeAll(B1);
        rightClone.retainAll(B1);
        leftClone.addAll(rightClone);
        return leftClone;
    }
View Full Code Here


        // end the shortest Edge-disjoint augmenting paths.
        // Side effect: For any Edge v.layer has the index of
        // the BFS layer to reach this Edge (or -1)
        // B: potential beginning of augmenting paths

        Set<BipartiteNode<T>> Q = new FastSet(B);
        // F: The set of free endings (the other side of augmenting paths)
        Set<BipartiteNode<T>> F = FastSet.newInstance();
        for (BipartiteNode<T> node : U) {
            node.layer = -1;
        }
        for (BipartiteNode<T> node : V) {
            node.layer = -1;
        }

        // The potential beginnings of augmenting paths are at layer 0.
        for (BipartiteNode<T> node : B) {
            node.layer = 0;
        }

        while (!Q.isEmpty()) {
            Set<BipartiteNode<T>> G = FastSet.newInstance();

            for (BipartiteNode<T> q : Q) {
                for (Edge<BipartiteNode<T>> v : edges) {
                    if (v.getSource() == q || v.getTarget() == q) {
                        BipartiteNode<T> p;
                        if (v.getSource() == q)
                            p = v.getTarget();
                        else
                            // (v.getTarget() == q)
                            p = v.getSource();
                        if (p.layer == -1) {
                            p.layer = q.layer + 1;
                            if (p.matching == null)
                                // Collect the free Edge, continue BFS
                                F.add(p);
                            else
                                G.add(p);
                        }
                    }
                }
            }
            if (!F.isEmpty())
                // Free vertices found, stop at this layer.
                return F;

            Q.clear();
            for (BipartiteNode<T> q : G) {
                // By construction, q matched.
                BipartiteNode<T> p = q.matching;
                p.layer = q.layer + 1;
                Q.add(p);
            }
        }

        return FastSet.newInstance();
    }
View Full Code Here

        return getOutEdgeObjects().unmodifiable();
      } else {
        return getOutEdgeObjects(labels);
      }
    } else {
      FastSet result = new FastSet<Edge>();
      if (labels == null || labels.length == 0) {
        result.addAll(getInEdgeObjects());
        result.addAll(getOutEdgeObjects());
      } else {
        result.addAll(getInEdgeObjects(labels));
        result.addAll(getOutEdgeObjects(labels));
      }
      return result.unmodifiable();
    }
  }
View Full Code Here

TOP

Related Classes of javolution.util.FastSet

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.