Fix KeyError seen during node2vec by allowing walker to initialize both directions of non-directed graph edges.

This commit is contained in:
Evan Radkoff 2020-07-21 11:15:22 -07:00
parent 7de7a09aa1
commit dc135a8475

View File

@ -191,6 +191,8 @@ class RandomWalker:
for edge in G.edges():
alias_edges[edge] = self.get_alias_edge(edge[0], edge[1])
if not G.is_directed():
alias_edges[(edge[1], edge[0])] = self.get_alias_edge(edge[1], edge[0])
self.alias_edges = alias_edges
self.alias_nodes = alias_nodes