Hanjun-Dai / graph_comb_opt

Implementation of "Learning Combinatorial Optimization Algorithms over Graphs"
https://arxiv.org/abs/1704.01665
MIT License
491 stars 135 forks source link

Error on evaluation of s2v_maxcut #3

Closed ariewahyu closed 5 years ago

ariewahyu commented 6 years ago

I managed to execute run_nstep_dqn.sh of s2v_maxcut. But, I got this error when executing run_eval.sh: Traceback (most recent call last): File "evaluate.py", line 69, in <module> api.InsertGraph(g, is_test=True) File "/home/abcd/graph_comb_opt/code/s2v_maxcut/maxcut_lib/maxcut_lib.py", line 45, in InsertGraph n_nodes, n_edges, e_froms, e_tos, weights = self.__CtypeNetworkX(g) File "/home/abcd/graph_comb_opt/code/s2v_maxcut/maxcut_lib/maxcut_lib.py", line 24, in __CtypeNetworkX edges = list(g.edges_iter(data='weight', default=1)) AttributeError: 'Graph' object has no attribute 'edges_iter'

Hanjun-Dai commented 6 years ago

Which version of networkx are you using? The current code works with networkx 1.11

ariewahyu commented 6 years ago

I changed to networx 1.11, python 2.7. Then the error changed to this: Traceback (most recent call last): File "evaluate.py", line 69, in <module> api.InsertGraph(g, is_test=True) File "/home/abcd/graph_comb_opt/code/s2v_maxcut/maxcut_lib/maxcut_lib.py", line 45, in InsertGraph n_nodes, n_edges, e_froms, e_tos, weights = self.__CtypeNetworkX(g) File "/home/abcd/graph_comb_opt/code/s2v_maxcut/maxcut_lib/maxcut_lib.py", line 24, in __CtypeNetworkX edges = list(g.edges_iter(data='weight', default=1)) File "/home/abcd/anaconda2/envs/my-env/lib/python2.7/site-packages/networkx-1.11-py2.7.egg/networkx/classes/graph.py", line 1191, in edges_iter nodes_nbrs = self.adj.items() AttributeError: 'Graph' object has no attribute 'adj'

Divide-By-0 commented 5 years ago

In case anyone else had this problem, it was resolved by changing edges_iter to edges.