In get_alias_edge, the probabilities of node neighbors are calculated, based on the last visited edge. The code that calculates this is:
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)
In the paper this is represented as the distance from t to x is equal to one, here t == src, and x == dst_nbr. In an undirected graph this does not change anything but in a directed one it does.
In get_alias_edge, the probabilities of node neighbors are calculated, based on the last visited edge. The code that calculates this is:
in the second case, I think this should be:
In the paper this is represented as the distance from t to x is equal to one, here t == src, and x == dst_nbr. In an undirected graph this does not change anything but in a directed one it does.