Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Root nodes have no neighbors on directed graphs #46

Closed
eliorc opened this issue Sep 29, 2020 · 1 comment
Closed

Root nodes have no neighbors on directed graphs #46

eliorc opened this issue Sep 29, 2020 · 1 comment
Assignees
Labels

Comments

@eliorc
Copy link
Owner

eliorc commented Sep 29, 2020

Nodes with no in-degrees generate walks with only themselves - meaning they cannot be considered while traveling and this effects directed graphs.

To reproduce:

import networkx as nx
from node2vec import Node2Vec

DG = nx.DiGraph()
DG.add_edges_from([('1', '2'), ('2', '5'), ('2', '6'), ('3', '4'),
                   ('4', '5'), ('4', '6'), ('5', '7'), ('5', '8'),
                   ('6', '7'), ('6', '8'), ('7', '9'), ('8', '10')])

node2vec = Node2Vec(DG, dimensions=10, walk_length=10, num_walks=400, workers=1)
model = node2vec.fit(window=10)


for walk in node2vec.walks:
    if '1' in walk:
        print(walk)

Results in output of

['1']
['1']
['1']
['1']
.
.
.
.
@eliorc eliorc self-assigned this Sep 29, 2020
@eliorc eliorc added the bug label Sep 29, 2020
@eliorc
Copy link
Owner Author

eliorc commented Oct 3, 2020

Fixed in version v0.3.3

@eliorc eliorc closed this as completed Oct 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant