TuftsBCB / Walker

Python implementation of Kohler et al.'s random walk with restart
MIT License
29 stars 14 forks source link

execution errors #2

Closed ali3assi closed 6 years ago

ali3assi commented 6 years ago

Hello,

I tried to run the code using the command you mentionned. I get the following error:

Traceback (most recent call last):
  File "run_walker.py", line 80, in <module>
    main(sys.argv)
  File "run_walker.py", line 76, in main
    wk.run_exp(seed_list, opts.restart_prob,opts.original_graph_prob, node_list)
  File "./Python_directory/Walker/walker.py", line 57, in run_exp
    p_0 = self._set_up_p0(source)
  File "./Python_directory/Walker/walker.py", line 121, in _set_up_p0
    source_index = self.OG.nodes().index(source_id)
AttributeError: 'NodeView' object has no attribute 'index'

Can i get your help to solve this issue?

jjc2718 commented 6 years ago

This looks like a versioning issue with NetworkX: currently, the Walker code is incompatible with versions of NetworkX >= 2.0 (the latest version is v2.1).

The easiest fix is to downgrade your NetworkX version to v1.11. Something like conda install networkx==1.11 should work if you're using Conda, if not try pip install networkx==1.11.

I'll make this clearer in the README. Let me know if the test still doesn't work after making that change.

ali3assi commented 6 years ago

@jjc2718 thank you for your answer. I solved this issue by justr transform self.OG.nodes to a list as l = list(self.OG.nodes()). And then your code work fine :)