adocherty / node2vec_linkprediction

Testing link prediction using Node2Vec
MIT License
68 stars 28 forks source link

TypeError: 'int' object has no attribute '__getitem__' #2

Open zuozijiZHOULI opened 5 years ago

zuozijiZHOULI commented 5 years ago

Traceback (most recent call last): File "link_prediction.py", line 548, in test_edge_functions(args) File "link_prediction.py", line 322, in test_edge_functions Gtrain, Gtest = create_train_test_graphs(args) File "link_prediction.py", line 300, in create_train_test_graphs directed=args.directed) File "link_prediction.py", line 109, in read_graph G.edges[edge[0]][edge[1]]['weight'] = 1 TypeError: 'int' object has no attribute 'getitem'

zpengc commented 2 years ago

the error line is at G.edges[edge[0]][edge[1]]['weight'] = 1. Just convert it to G[edge[0]][edge[1]]['weight'] = 1