palash1992 / GEM

BSD 3-Clause "New" or "Revised" License
1.28k stars 362 forks source link

networkx.exception.NetworkXError: nbunch is not a node or a sequence of nodes. #64

Closed houker closed 5 years ago

houker commented 5 years ago

hello, i meet some problems when run this programming, and hope someone could solve it. Traceback (most recent call last): File "C:\Users\dell\Anaconda3\lib\site-packages\networkx\classes\graph.py", line 1906, in bunch_iter for n in nlist: TypeError: 'int' object is not iterable

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "node2vec_test.py", line 144, in MAP = metrics.computeMAP(filtered_edge_list, test_digraph) File "E:\Ke Hou\code_incompelete_graph\GraphEmbedding-master\GraphEmbedding-master\examples\gem\evaluation\metrics.py", line 39, in computeMAP if true_digraph.out_degree(i) == 0: File "C:\Users\dell\Anaconda3\lib\site-packages\networkx\classes\digraph.py", line 1119, in out_degree return dict(self.out_degree_iter(nbunch,weight)) File "C:\Users\dell\Anaconda3\lib\site-packages\networkx\classes\digraph.py", line 1031, in out_degree_iter for n,nbrs in nodes_nbrs: File "C:\Users\dell\Anaconda3\lib\site-packages\networkx\classes\digraph.py", line 1028, in nodes_nbrs=((n,self.succ[n]) for n in self.nbunch_iter(nbunch)) File "C:\Users\dell\Anaconda3\lib\site-packages\networkx\classes\graph.py", line 1914, in bunch_iter "nbunch is not a node or a sequence of nodes.") networkx.exception.NetworkXError: nbunch is not a node or a sequence of nodes.

when i apply it in link prediction, this problem often appear. I'm looking forward for your reply.

houker commented 5 years ago

btw, I have found that you will update the version this month, thank you very much.

handychimp commented 5 years ago

I am experiencing the same problem. Run on the example code with a custom edge list, and then again with the karate list

EDIT: Sorry, correction on that, I was still referencing the old list. It seems likely that it's to do with the labels assigned to your nodes or the format of the edge list you fed in