use of it.unimi.dsi.fastutil.longs.Long2ObjectMap.Entry in project angel by Tencent.
the class SampleUtils method sampleNodeFeatByCount.
public static IntFloatVector[] sampleNodeFeatByCount(ServerRow row, int count, long seed) {
Random r = new Random(seed);
IntFloatVector[] feats = new IntFloatVector[count];
int bound = row.size() - count;
int skip = bound > 0 ? r.nextInt(bound) : 0;
ObjectIterator<Entry<IElement>> it = (((ServerLongAnyRow) row).getStorage()).iterator();
it.skip(skip);
for (int i = 0; i < count; i++) {
feats[i] = ((GraphNode) it.next().getValue()).getFeats();
}
return feats;
}
use of it.unimi.dsi.fastutil.longs.Long2ObjectMap.Entry in project angel by Tencent.
the class GetNodes method partitionGet.
@Override
public PartitionGetResult partitionGet(PartitionGetParam param) {
ServerLongAnyRow row = GraphMatrixUtils.getPSLongKeyRow(psContext, param);
ObjectIterator<Entry<IElement>> it = row.iterator();
LongArrayList nodes = new LongArrayList();
Boolean isHash = ((PartGetNodesParam) param).getHash();
long start = isHash ? 0 : param.getPartKey().getStartCol();
while (it.hasNext()) {
Long2ObjectMap.Entry entry = it.next();
GraphNode node = (GraphNode) entry.getValue();
if (node.getFeats() != null && node.getNeighbors() == null) {
nodes.add(entry.getLongKey() + start);
}
}
return new IndexPartGetLongResult(param.getPartKey(), nodes.toLongArray());
}
Aggregations