diaohancai commented on code in PR #280:
URL:
https://github.com/apache/incubator-hugegraph-computer/pull/280#discussion_r1398770240
##########
computer-algorithm/src/main/java/org/apache/hugegraph/computer/algorithm/sampling/RandomWalk.java:
##########
@@ -146,29 +237,129 @@ public void compute(ComputationContext context, Vertex
vertex,
continue;
}
+ vertex.edges().forEach(edge ->
message.addToPreVertexAdjacence(edge.targetId()));
+
// random select one edge and walk
- Edge selectedEdge = this.randomSelectEdge(vertex.edges());
+ Edge selectedEdge = this.randomSelectEdge(preVertexId,
message.preVertexAdjacence(),
+ vertex.edges());
context.sendMessage(selectedEdge.targetId(), message);
}
}
/**
* random select one edge
*/
- private Edge randomSelectEdge(Edges edges) {
- Edge selectedEdge = null;
- int randomNum = random.nextInt(edges.size());
+ private Edge randomSelectEdge(Id preVertexId, IdList
preVertexAdjacenceIdList, Edges edges) {
+ List<Double> weightList = new ArrayList<>();
Review Comment:
### awesome
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]