aditya-grover / node2vec

http://snap.stanford.edu/node2vec/
MIT License
2.6k stars 912 forks source link

Qusetion:How to input weight graph? #109

Open jichao-ren opened 3 years ago

jichao-ren commented 3 years ago

Hello! I would like to try to apply this algorithm to the user user weight graph to represent each user node by vector. At present, I use the three column saving method, < user node1 user node2 weight_ float> .However, the current display prompt is as follows:

Input: 0 11 0.8750 0 29 0.7170 0 61 0.6480 0 76 1.0000 0 79 1.9340 0 91 0.3680 0 92 1.0000

File "D:\Anaconda3\lib\site-packages\networkx\readwrite\edgelist.py", line 277, in parse_edgelist edgedata = dict(literal_eval(' '.join(d))) TypeError: 'float' object is not iterable File "E:/node2vec04/node2vec/src/main.py", line 91, in read_graph G = nx.read_edgelist(args.input, nodetype=int, create_using=nx.DiGraph()) File "<D:\Anaconda3\lib\site-packages\decorator.py:decorator-gen-584>", line 2, in read_edgelist File "D:\Anaconda3\lib\site-packages\networkx\utils\decorators.py", line 240, in _open_file result = func_to_be_decorated(*new_args, **kwargs) File "D:\Anaconda3\lib\site-packages\networkx\readwrite\edgelist.py", line 369, in read_edgelist data=data) File "D:\Anaconda3\lib\site-packages\networkx\readwrite\edgelist.py", line 280, in parse_edgelist "Failed to convert edge data (%s) to dictionary." % (d)) TypeError: Failed to convert edge data (['0.8750']) to dictionary.

Thank you very much in advance.