Package edu.cmu.graphchi.datablocks

Examples of edu.cmu.graphchi.datablocks.ChiPointer


            Iterator<Integer> iter = vertexData.currentIterator();

            while (iter.hasNext()) {
                int j = iter.next();
                ChiPointer ptr = vertexData.getVertexValuePtr(j, blockId);
                VertexDataType oldValue = blockManager.dereference(ptr, conv);
                VertexDataType newValue = callback.map(j, oldValue);
                blockManager.writeValue(ptr, conv, newValue);
            }
            vertexData.releaseAndCommit(i, blockId);
View Full Code Here


            Iterator<Integer> iter = vertexData.currentIterator();

            while (iter.hasNext()) {
                int j = iter.next();
                ChiPointer ptr = vertexData.getVertexValuePtr(j, blockId);
                VertexDataType value = blockManager.dereference(ptr, conv);
                callback.callback(j, value);
            }
        }
    }
View Full Code Here

            @Override
            public VertexIdValue next() {
                if (hasNext()) {
                    i = curIter.next();
                    ChiPointer ptr = vertexData.getVertexValuePtr(i, blockId);
                    return new VertexIdValue<VertexDataType>(idTranslate.backward(i), blockManager.dereference(ptr, conv));
                } else throw new IllegalStateException("No more elements in the iterator!");
            }

            @Override
View Full Code Here

    private ChiPointer readEdgePtr() {
        assert(sizeOf >= 0);
        if (onlyAdjacency) return null;
        checkCurblock(sizeOf);
        ChiPointer ptr = new ChiPointer(curBlock.blockId, curBlock.ptr);
        curBlock.ptr += sizeOf;
        edataOffset += sizeOf;
        return ptr;
    }
View Full Code Here

                    if (vertex != null) {
                        while (--n >= 0) {
                            int target = adjFile.readIntReversed();
                            adjOffset += 4;
                            ChiPointer eptr = readEdgePtr();

                            if (!onlyAdjacency) {
                                if (!curBlock.active) {
                                    if (asyncEdataLoading) {
                                        curBlock.readAsync();
View Full Code Here

    }

    public ChiPointer getVertexValuePtr(int vertexId, int blockId) {
        assert(vertexId >= vertexSt && vertexId <= vertexEn);
        if (!sparse) {
            return new ChiPointer(blockId, (vertexId - vertexSt) * converter.sizeOf());
        } else {
            int idx = Arrays.binarySearch(index, vertexId);
            if (idx < 0) {
                return null;
            }
            return new ChiPointer(blockId, idx * converter.sizeOf());
        }
    }
View Full Code Here

                        iterIdx++;
                    }
                    if (iterIdx >= vertexIds.length) break;

                    if (curId == (int) vertexIds[iterIdx]) {
                        ChiPointer pointer = vertexData.getVertexValuePtr(curId, blockId);
                        System.arraycopy(vertexValues, iterIdx * sizeOf, vertexValueTemplate, 0, sizeOf);
                        dataBlockManager.writeValue(pointer, vertexValueTemplate);
                    } else {
                        // No vertex data for that vertex.
                    }
View Full Code Here

     * @return edge object
     */
    public ChiEdge<EdgeValue> inEdge(int i) {
        if (edgeValueConverter != null) {
            int idx = i * 3;
            return new Edge(new ChiPointer(inEdgeDataArray[idx], inEdgeDataArray[idx + 1]), inEdgeDataArray[idx + 2]);
        } else {
            return new Edge(null, inEdgeDataArray[i]);
        }
    }
View Full Code Here

     * @return  edge object
     */
    public ChiEdge<EdgeValue>  outEdge(int i) {
        if (edgeValueConverter != null) {
            int idx = i * 3;
            return new Edge(new ChiPointer(outEdgeDataArray[idx], outEdgeDataArray[idx + 1]), outEdgeDataArray[idx + 2]);
        } else {
            return new Edge(null, outEdgeDataArray[i]);
        }
    }
View Full Code Here

     * @param i
     * @return  the value of i'th outedge (short-cut to outEdge(i)->getValue())
     */
    public EdgeValue getOutEdgeValue(int i) {
        int idx = i * 3;
        return blockManager.dereference(new ChiPointer(outEdgeDataArray[idx], outEdgeDataArray[idx + 1]),
                (BytesToValueConverter<EdgeValue>) edgeValueConverter);
    }
View Full Code Here

TOP

Related Classes of edu.cmu.graphchi.datablocks.ChiPointer

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.