an error in walker maybe?
Nitinsiwach opened this issue · 2 comments
Nitinsiwach commented
I dont know much about this work in details. however, while implementing i am running into sample larger than population
. I think in src/walker.py it should be
def small_walk(self, start_node):
"""
Doing a truncated random walk.
:param start_node: Start node for random walk.
:return walk: Truncated random walk with fixed maximal length.
"""
walk = [start_node]
while len(walk) < self.args.walk_length:
if len(nx.neighbors(self.graph,walk[-1])) ==0:
break
walk = walk + [random.sample(nx.neighbors(self.graph,walk[-1]),1)[0]]
return walk
Instead of
def small_walk(self, start_node):
"""
Doing a truncated random walk.
:param start_node: Start node for random walk.
:return walk: Truncated random walk with fixed maximal length.
"""
walk = [start_node]
while len(walk) < self.args.walk_length:
walk = walk + [random.sample(nx.neighbors(self.graph,walk[-1]),1)[0]]
if len(nx.neighbors(self.graph,walk[-1])) ==0:
break
return walk
benedekrozemberczki commented
Do You want to open a pull request?
…On Thu, 4 Apr 2019 at 22:25, Nitin Siwach ***@***.***> wrote:
I dont know much about this work in details. however, while implementing i
am running into sample larger than population. I think in src/walker.py
it should be
def small_walk(self, start_node):
"""
Doing a truncated random walk.
:param start_node: Start node for random walk.
:return walk: Truncated random walk with fixed maximal length.
"""
walk = [start_node]
while len(walk) < self.args.walk_length:
if len(nx.neighbors(self.graph,walk[-1])) ==0:
break
walk = walk + [random.sample(nx.neighbors(self.graph,walk[-1]),1)[0]]
return walk
Instead of
def small_walk(self, start_node):
"""
Doing a truncated random walk.
:param start_node: Start node for random walk.
:return walk: Truncated random walk with fixed maximal length.
"""
walk = [start_node]
while len(walk) < self.args.walk_length:
walk = walk + [random.sample(nx.neighbors(self.graph,walk[-1]),1)[0]]
if len(nx.neighbors(self.graph,walk[-1])) ==0:
break
return walk
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#2>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/AQk2F4zatwEP-6Q6XTjsp69Xvwr7x_O_ks5vdm3ZgaJpZM4cdvg5>
.
benedekrozemberczki commented
Corrected.