use of com.tencent.angel.ps.storage.vector.ServerLongAnyRow in project angel by Tencent.
the class InitEdgeWeights method partitionUpdate.
@Override
public void partitionUpdate(PartitionUpdateParam partParam) {
GeneralPartUpdateParam param = (GeneralPartUpdateParam) partParam;
ServerLongAnyRow row = GraphMatrixUtils.getPSLongKeyRow(psContext, param);
ILongKeyAnyValuePartOp keyValuePart = (ILongKeyAnyValuePartOp) param.getKeyValuePart();
long[] nodeIds = keyValuePart.getKeys();
IElement[] neighbors = keyValuePart.getValues();
row.startWrite();
try {
for (int i = 0; i < nodeIds.length; i++) {
GraphNode graphNode = (GraphNode) row.get(nodeIds[i]);
if (graphNode == null) {
graphNode = new GraphNode();
row.set(nodeIds[i], graphNode);
}
graphNode.setWeights(((Weights) neighbors[i]).getWeights());
}
} finally {
row.endWrite();
}
}
use of com.tencent.angel.ps.storage.vector.ServerLongAnyRow in project angel by Tencent.
the class InitNeighbor method partitionUpdate.
@Override
public void partitionUpdate(PartitionUpdateParam partParam) {
GeneralPartUpdateParam param = (GeneralPartUpdateParam) partParam;
ServerLongAnyRow row = GraphMatrixUtils.getPSLongKeyRow(psContext, param);
ILongKeyAnyValuePartOp keyValuePart = (ILongKeyAnyValuePartOp) param.getKeyValuePart();
long[] nodeIds = keyValuePart.getKeys();
IElement[] neighbors = keyValuePart.getValues();
row.startWrite();
try {
for (int i = 0; i < nodeIds.length; i++) {
GraphNode graphNode = (GraphNode) row.get(nodeIds[i]);
if (graphNode == null) {
graphNode = new GraphNode();
row.set(nodeIds[i], graphNode);
}
graphNode.setNeighbors(((LongNeighbor) neighbors[i]).getNodeIds());
}
} finally {
row.endWrite();
}
}
use of com.tencent.angel.ps.storage.vector.ServerLongAnyRow in project angel by Tencent.
the class InitNodeTypes method partitionUpdate.
@Override
public void partitionUpdate(PartitionUpdateParam partParam) {
GeneralPartUpdateParam param = (GeneralPartUpdateParam) partParam;
ServerLongAnyRow row = GraphMatrixUtils.getPSLongKeyRow(psContext, param);
ILongKeyAnyValuePartOp keyValuePart = (ILongKeyAnyValuePartOp) param.getKeyValuePart();
long[] nodeIds = keyValuePart.getKeys();
IElement[] neighbors = keyValuePart.getValues();
row.startWrite();
try {
for (int i = 0; i < nodeIds.length; i++) {
GraphNode graphNode = (GraphNode) row.get(nodeIds[i]);
if (graphNode == null) {
graphNode = new GraphNode();
row.set(nodeIds[i], graphNode);
}
graphNode.setTypes(((NodeType) neighbors[i]).getTypes());
}
} finally {
row.endWrite();
}
}
use of com.tencent.angel.ps.storage.vector.ServerLongAnyRow in project angel by Tencent.
the class SampleNodeFeat method partitionGet.
@Override
public PartitionGetResult partitionGet(PartitionGetParam partParam) {
PartSampleNodeFeatParam sampleParam = (PartSampleNodeFeatParam) partParam;
ServerLongAnyRow row = GraphMatrixUtils.getPSLongKeyRow(psContext, partParam);
int count = Math.min(row.size(), sampleParam.getCount());
IntFloatVector[] feats = SampleUtils.sampleNodeFeatByCount(row, count, System.currentTimeMillis());
return new PartSampleNodeFeatResult(sampleParam.getPartKey().getPartitionId(), feats);
}
Aggregations