Search in sources :

Example 1 with GetElementResult

use of com.tencent.angel.graph.common.psf.result.GetElementResult in project angel by Tencent.

the class GeneralGet method merge.

@Override
public GetResult merge(List<PartitionGetResult> partResults) {
    int resultSize = 0;
    for (PartitionGetResult result : partResults) {
        resultSize += ((PartGeneralGetResult) result).getNodeIds().length;
    }
    Long2ObjectOpenHashMap nodeIdToNeighbors = new Long2ObjectOpenHashMap<>(resultSize);
    for (PartitionGetResult result : partResults) {
        PartGeneralGetResult getResult = (PartGeneralGetResult) result;
        long[] nodeIds = getResult.getNodeIds();
        IElement[] objs = getResult.getData();
        for (int i = 0; i < nodeIds.length; i++) {
            nodeIdToNeighbors.put(nodeIds[i], objs[i]);
        }
    }
    return new GetElementResult(nodeIdToNeighbors);
}
Also used : IElement(com.tencent.angel.ps.storage.vector.element.IElement) Long2ObjectOpenHashMap(it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap) PartitionGetResult(com.tencent.angel.ml.matrix.psf.get.base.PartitionGetResult) GetElementResult(com.tencent.angel.graph.common.psf.result.GetElementResult)

Aggregations

GetElementResult (com.tencent.angel.graph.common.psf.result.GetElementResult)1 PartitionGetResult (com.tencent.angel.ml.matrix.psf.get.base.PartitionGetResult)1 IElement (com.tencent.angel.ps.storage.vector.element.IElement)1 Long2ObjectOpenHashMap (it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap)1