I'm implementing PageRank using Spargel in the send messenge step I need to devide the Node value by the degree of the Node.
Can I get the degree of a node somehow, or do I have to Store it on the node). I tried the code below but that gives me an exception at runtime telling me its illegal to go through the edges twice.
public void sendMessages(String vertexId, Double newRank) {
int numOutEdge = 0;
for (Iterator<OutgoingEdge<String, Double>> iterator = getOutgoingEdges()
.iterator(); iterator.hasNext();) {
iterator.next();
numOutEdge++;
}
for (OutgoingEdge<String, Double> edge : getOutgoingEdges()) {
sendMessageTo(edge.target(), newRank * 1 / numOutEdge);
}
}
cheers Martin
Yes, the edges are "streamed". In theory that protects you from problems with large edge lists but in practice that is not really an issue.
I think you can simply buffer them in an array.
--
You received this message because you are subscribed to a topic in the Google Groups "stratosphere-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/stratosphere-dev/Ct3fbS4az_o/unsubscribe.
To unsubscribe from this group and all its topics, send an email to stratosphere-d...@googlegroups.com.
Visit this group at http://groups.google.com/group/stratosphere-dev.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "stratosphere-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to stratosphere-d...@googlegroups.com.