Package edu.ucla.sspace.util.primitive

Examples of edu.ucla.sspace.util.primitive.IntSet


            final int v1 = iter1.nextInt();
            WORK_QUEUE.add(taskKey, new Runnable() {
                    public void run() {
                        veryVerbose(LOGGER, "Computing similarities for " +
                                    "vertex %d", v1);
                        IntSet neighbors = g.getNeighbors(v1);
                        IntIterator it1 = neighbors.iterator();
                        while (it1.hasNext()) {
                            int v2 = it1.nextInt();
                            IntIterator it2 = neighbors.iterator();
                            while (it2.hasNext()) {
                                int v3 = it2.nextInt();
                                if (v2 == v3)
                                    break;
                                double sim = getConnectionSimilarity(
View Full Code Here


            WORK_QUEUE.add(key, new Runnable() {
                    public void run() {
                        veryVerbose(LOGGER, "Computing similarities for " +
                                    "vertex %d", v1);
                        //Set<E> adjList = graph.getAdjacencyList(v1);
                        IntSet neighbors = graph.getNeighbors(v1);
                        // Create a thread-local PriorityQueue that will hold
                        // the edge similarities for this vertex.  Once all the
                        // simialrites have been computed, we can update the
                        // thread-shared queue with minimal locking
                        PriorityQueue<EdgePair> localQ =
                            new PriorityQueue<EdgePair>(neighbors.size());
                        IntIterator it1 = neighbors.iterator();
                        // for (E e1 : adjList) {
                        while (it1.hasNext()) {
                            // int v2 = (e1.to() == v1) ? e1.from() : e1.to();
                            int v2 = it1.nextInt();
                           
                            IntIterator it2 = neighbors.iterator();
                            // for (Edge e2 : graph.getAdjacencyList(v1)) {
                            while (it2.hasNext()) {
                                int v3 = it2.nextInt();
                                if (v2 == v3)
                                    break;
View Full Code Here

     * @return the similarity of the edges.a
     */
    protected <E extends Edge> double getConnectionSimilarity(
            Graph<E> graph, int keystone, int impost1, int impost2) {
       
        IntSet n1 = graph.getNeighbors(impost1);
        IntSet n2 = graph.getNeighbors(impost2);
        int n1size = n1.size();
        int n2size = n2.size();
        // Swap based on size prior to searching for which vertices are in
        // common
        if (n1size > n2size) {
            IntSet tmp = n2;
            n2 = n1;
            n1 = tmp;
            int t = impost1;
            impost1 = impost2;
            impost2 = t;
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public IntSet predecessors(int vertex) {
        Set<T> in = inEdges(vertex);
        IntSet preds = new TroveIntSet();
        if (in.isEmpty())
            return preds;
        for (T e : in)
            preds.add(e.from());
        return preds;
    }
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public IntSet successors(int vertex) {
        Set<T> out = outEdges(vertex);
        IntSet succs = new TroveIntSet();
        if (out.isEmpty())
            return succs;
        for (T e : out)
            succs.add(e.to());
        return succs;
    }
View Full Code Here

    public void add(int key, int value) {
        inner.put(key,value);
    }

    public int[] remove(int key) {
        IntSet relIds = inner.remove(key);
        if (relIds==null) return null;
        return relIds.toPrimitiveArray();
    }
View Full Code Here

TOP

Related Classes of edu.ucla.sspace.util.primitive.IntSet

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.