Skip to content

Commit

Permalink
🐛 Fix no-in-degree missing neighbors bug
Browse files Browse the repository at this point in the history
  • Loading branch information
eliorc committed Oct 3, 2020
1 parent db45ac6 commit 7da7572
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions node2vec/node2vec.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,6 @@ def _precompute_probabilities(self):
d_graph[current_node][self.PROBABILITIES_KEY][
source] = unnormalized_weights / unnormalized_weights.sum()

# Save neighbors
d_graph[current_node][self.NEIGHBORS_KEY] = d_neighbors

# Calculate first_travel weights for source
first_travel_weights = []

Expand All @@ -127,6 +124,9 @@ def _precompute_probabilities(self):
first_travel_weights = np.array(first_travel_weights)
d_graph[source][self.FIRST_TRAVEL_KEY] = first_travel_weights / first_travel_weights.sum()

# Save neighbors
d_graph[source][self.NEIGHBORS_KEY] = list(self.graph.neighbors(source))

def _generate_walks(self) -> list:
"""
Generates the random walks which will be used as the skip-gram input.
Expand Down

0 comments on commit 7da7572

Please sign in to comment.