node2vec icon indicating copy to clipboard operation
node2vec copied to clipboard

How to define "α=1 node" in directed graph?

Open TigerSong opened this issue 7 years ago • 0 comments

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?

TigerSong avatar Sep 10 '18 10:09 TigerSong