node2vec
node2vec copied to clipboard
How to define "α=1 node" in directed graph?
last node: t curr node: x next node: y In local version, "α=1 node" y is the node that there is an edge y->t in graph.
for dst_nbr in sorted(G.neighbors(dst)): if dst_nbr == src: unnormalized_probs.append(G[dst][dst_nbr]['weight']/p) elif G.has_edge(dst_nbr, src): unnormalized_probs.append(G[dst][dst_nbr]['weight']) else: unnormalized_probs.append(G[dst][dst_nbr]['weight']/q)
But in spark version, "α=1 node" y is the node that there is an edge t->y in graph.
val neighbors_ = dstNeighbors.map { case (dstNeighborId, weight) => var unnormProb = weight / q if (srcId == dstNeighborId) unnormProb = weight / p else if (srcNeighbors.exists(_._1 == dstNeighborId)) unnormProb = weight (dstNeighborId, unnormProb) }
So, which one is correct?