use of com.baidu.hugegraph.computer.core.graph.value.LongValue in project hugegraph-computer by hugegraph.
the class EdgeMessageRecvPartitionTest method addTenEdgeBuffer.
public static void addTenEdgeBuffer(Consumer<ManagedBuffer> consumer) throws IOException {
for (long i = 0L; i < 10L; i++) {
Vertex vertex = graphFactory().createVertex();
vertex.id(BytesId.of(i));
Edges edges = graphFactory().createEdges(2);
for (long j = i + 1; j < i + 3; j++) {
Edge edge = graphFactory().createEdge();
edge.targetId(BytesId.of(j));
Properties properties = graphFactory().createProperties();
properties.put("p1", new LongValue(i));
edge.properties(properties);
edges.add(edge);
}
vertex.edges(edges);
ReceiverUtil.consumeBuffer(writeEdges(vertex), consumer);
}
}
use of com.baidu.hugegraph.computer.core.graph.value.LongValue in project hugegraph-computer by hugegraph.
the class EdgeMessageRecvPartitionTest method addTenDuplicateEdgeBuffer.
private static void addTenDuplicateEdgeBuffer(Consumer<ManagedBuffer> consumer) throws IOException {
for (long i = 0L; i < 10L; i++) {
Vertex vertex = graphFactory().createVertex();
vertex.id(BytesId.of(i));
Edges edges = graphFactory().createEdges(2);
for (long j = i + 1; j < i + 3; j++) {
Edge edge = graphFactory().createEdge();
edge.targetId(BytesId.of(j));
Properties properties = graphFactory().createProperties();
properties.put("p1", new LongValue(i));
edge.properties(properties);
edges.add(edge);
}
vertex.edges(edges);
ReceiverUtil.consumeBuffer(writeEdges(vertex), consumer);
}
for (long i = 0L; i < 10L; i++) {
Vertex vertex = graphFactory().createVertex();
vertex.id(BytesId.of(i));
Edges edges = graphFactory().createEdges(2);
for (long j = i + 1; j < i + 3; j++) {
Edge edge = graphFactory().createEdge();
edge.targetId(BytesId.of(j));
Properties properties = graphFactory().createProperties();
properties.put("p2", new LongValue(2L * i));
edge.properties(properties);
edges.add(edge);
}
vertex.edges(edges);
ReceiverUtil.consumeBuffer(writeEdges(vertex), consumer);
}
}
use of com.baidu.hugegraph.computer.core.graph.value.LongValue in project hugegraph-computer by hugegraph.
the class VertexMessageRecvPartitionTest method addTwentyDuplicateVertexBuffer.
private static void addTwentyDuplicateVertexBuffer(Consumer<ManagedBuffer> consumer) throws IOException {
for (long i = 0L; i < 10L; i++) {
Vertex vertex = graphFactory().createVertex();
vertex.id(BytesId.of(i));
Properties properties = graphFactory().createProperties();
properties.put("p1", new LongValue(i));
vertex.properties(properties);
ReceiverUtil.consumeBuffer(writeVertex(vertex), consumer);
}
for (long i = 0L; i < 10L; i++) {
Vertex vertex = graphFactory().createVertex();
vertex.id(BytesId.of(i));
Properties properties = graphFactory().createProperties();
properties.put("p2", new LongValue(2L * i));
vertex.properties(properties);
ReceiverUtil.consumeBuffer(writeVertex(vertex), consumer);
}
}
Aggregations