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

Weighted networks? #2

Closed
anthonimes opened this issue Jul 20, 2020 · 1 comment
Closed

Weighted networks? #2

anthonimes opened this issue Jul 20, 2020 · 1 comment

Comments

@anthonimes
Copy link

Hello!

I am successfully using Walklets so far, so this is more a question than an issue. :)
Is it possible to adapt your code to work with edge-weighted networks?

It is mentioned in your article that this can be done, but being a stranger to this domain I am afraid to do things the wrong way.
The only attempt I made so far was to change this part of the code:

for edge in tqdm(self.G.edges(data=True)):
    self.G[edge[0]][edge[1]]['weight'] = edge[2]['weight'] # 1.0
    self.G[edge[1]][edge[0]]['weight'] = edge[2]['weight'] # 1.0

in file walkers.py. But this actually does not seem to make any difference.

I apologize if my question is irrelevant or has a really easy answer,
Thanks in advance for your help!
Anthony

@benedekrozemberczki
Copy link
Owner

Hi there Anthony,

You have to write a sampler for random sampling of neighbors - ideally you would use a binary search tree or hopscotch sampling.

It is not a trivial problem.

Benedek

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants