use of com.tencent.angel.ps.storage.vector.ServerLongAnyRow in project angel by Tencent.
the class SampleEdgeFeat method partitionGet.
@Override
public PartitionGetResult partitionGet(PartitionGetParam partParam) {
PartSampleEdgeFeatParam sampleParam = (PartSampleEdgeFeatParam) partParam;
ServerLongAnyRow row = GraphMatrixUtils.getPSLongKeyRow(psContext, partParam);
ILongKeyPartOp split = (ILongKeyPartOp) sampleParam.getIndicesPart();
long[] nodeIds = split.getKeys();
Tuple2<Long2ObjectOpenHashMap<long[]>, Long2ObjectOpenHashMap<IntFloatVector[]>> nodeId2SampleNeighbors = SampleUtils.sampleEdgeFeat(row, sampleParam.getCount(), nodeIds, System.currentTimeMillis());
return new PartSampleEdgeFeatResult(sampleParam.getPartKey().getPartitionId(), nodeId2SampleNeighbors._1, nodeId2SampleNeighbors._2);
}
use of com.tencent.angel.ps.storage.vector.ServerLongAnyRow in project angel by Tencent.
the class SampleNeighbor method partitionGet.
@Override
public PartitionGetResult partitionGet(PartitionGetParam partParam) {
PartSampleNeighborParam sampleParam = (PartSampleNeighborParam) partParam;
ServerLongAnyRow row = GraphMatrixUtils.getPSLongKeyRow(psContext, partParam);
ILongKeyPartOp split = (ILongKeyPartOp) sampleParam.getIndicesPart();
long[] nodeIds = split.getKeys();
Long2ObjectOpenHashMap<long[]> nodeId2SampleNeighbors = SampleUtils.sampleByCount(row, sampleParam.getCount(), nodeIds, System.currentTimeMillis());
return new PartSampleNeighborResult(sampleParam.getPartKey().getPartitionId(), nodeId2SampleNeighbors);
}
use of com.tencent.angel.ps.storage.vector.ServerLongAnyRow in project angel by Tencent.
the class SampleNeighborWithFilter method partitionGet.
@Override
public PartitionGetResult partitionGet(PartitionGetParam partParam) {
PartSampleNeighborWithFilterParam sampleParam = (PartSampleNeighborWithFilterParam) partParam;
ServerLongAnyRow row = GraphMatrixUtils.getPSLongKeyRow(psContext, partParam);
ILongKeyLongValuePartOp split = (ILongKeyLongValuePartOp) sampleParam.getIndicesToFilterPart();
long[] nodeIds = split.getKeys();
long[] filterWithNeighKeys = split.getValues();
long[] filterWithoutNeighKeys = sampleParam.getFilterWithoutNeighKeys();
SampleType sampleType = sampleParam.getSampleType();
switch(sampleType) {
case NODE:
case EDGE:
{
Tuple2<Long2ObjectOpenHashMap<long[]>, Long2ObjectOpenHashMap<int[]>> nodeId2SampleNeighbors = SampleUtils.sampleWithType(row, nodeIds, sampleType, filterWithNeighKeys, filterWithoutNeighKeys, System.currentTimeMillis());
return new PartSampleNeighborResultWithType(sampleParam.getPartKey().getPartitionId(), nodeId2SampleNeighbors._1, nodeId2SampleNeighbors._2, sampleType);
}
default:
{
throw new UnsupportedOperationException("Not support sample type " + sampleType + " now");
}
}
}
use of com.tencent.angel.ps.storage.vector.ServerLongAnyRow in project angel by Tencent.
the class NnzEdge method processRow.
@Override
public double processRow(ServerRow row) {
LongElementStorage storage = ((ServerLongAnyRow) row).getStorage();
ObjectIterator<Long2ObjectMap.Entry<IElement>> it = storage.iterator();
long size = 0;
while (it.hasNext()) {
GraphNode node = (GraphNode) (it.next().getValue());
if (node.getNeighbors() != null) {
size += node.getNeighbors().length;
}
}
return size;
}
use of com.tencent.angel.ps.storage.vector.ServerLongAnyRow in project angel by Tencent.
the class NnzNeighbor method processRow.
@Override
public double processRow(ServerRow row) {
LongElementStorage storage = ((ServerLongAnyRow) row).getStorage();
ObjectIterator<Long2ObjectMap.Entry<IElement>> it = storage.iterator();
int size = 0;
while (it.hasNext()) {
GraphNode node = (GraphNode) (it.next().getValue());
if (node.getNeighbors() != null) {
size++;
}
}
return size;
}
Aggregations