node2vec: np.random.choice doesn't want a to be empty

while len(walk) < walk_length:
                    walk_options = d_graph[walk[-1]][neighbors_key]
                    
                    if len(walk) == 1:  # For the first step
                        walk_to = np.random.choice(walk_options, size=1)[0]
                    else:
                        probabilities = d_graph[walk[-1]][probabilities_key][walk[-2]]
                        walk_to = np.random.choice(walk_options, size=1, p=probabilities)[0]

This is giving error. Can you please look into it ? In some cases, walk_options is an empty list and hence the error. Is there any way around? I tried putting if conditions for empty case but it’s not working.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 16 (8 by maintainers)

Most upvoted comments

@pranavdogra7 , I believe this is fixed, please update your node2vec version to the lastest (0.1.2) and report if this was solved. Thanks