use of com.tencent.angel.graph.client.node2vec.params.PartitionGetParamWithIds in project angel by Tencent.
the class PullNeighbor method partitionGet.
@Override
public PartitionGetResult partitionGet(PartitionGetParam partParam) {
PartitionGetParamWithIds pparam = (PartitionGetParamWithIds) partParam;
long[] keyIds = pparam.getKeyIds();
ServerLongAnyRow row = (ServerLongAnyRow) psContext.getMatrixStorageManager().getRow(pparam.getPartKey(), 0);
Long2ObjectOpenHashMap<long[]> partResult = new Long2ObjectOpenHashMap<long[]>(keyIds.length);
boolean isTrunc = PathQueue.isIsTrunc();
if (PathQueue.getKeepProba() < 1.0 - 1e-6 && PathQueue.getKeepProba() > 1e-6) {
double selectThred = PathQueue.getThreshold() / (1 - PathQueue.getKeepProba());
for (long keyId : keyIds) {
LongArrayElement longArrayElement = (LongArrayElement) row.get(keyId);
long[] neighs = longArrayElement.getData();
if (isTrunc && neighs.length > selectThred) {
partResult.put(keyId, Arrays.copyOf(neighs, (int) selectThred));
} else {
partResult.put(keyId, neighs);
}
}
} else {
for (long keyId : keyIds) {
LongArrayElement longArrayElement = (LongArrayElement) row.get(keyId);
long[] neighs = longArrayElement.getData();
partResult.put(keyId, neighs);
}
}
return new PullNeighborPartitionResult(partResult);
}
Aggregations