Skip to content

Commit

Permalink
fix second node of weighted walk
Browse files Browse the repository at this point in the history
  • Loading branch information
louisabraham committed Jun 21, 2020
1 parent c6ba426 commit 948a5f2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fastnode2vec/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ def _random_walk_weighted(indptr, indices, data, walk_length, p, q, t):

walk = np.empty(walk_length, dtype=indices.dtype)
walk[0] = t
walk[1] = np.random.choice(_neighbors(indptr, indices, t))
walk[1] = _neighbors(indptr, indices, t)[
np.searchsorted(_neighbors(indptr, data, t), np.random.rand())
]
for j in range(2, walk_length):
neighbors = _neighbors(indptr, indices, walk[j - 1])
neighbors_p = _neighbors(indptr, data, walk[j - 1])
Expand Down

0 comments on commit 948a5f2

Please sign in to comment.