FilippoMB / Spectral-Clustering-with-Graph-Neural-Networks-for-Graph-Pooling

Experimental results obtained with the MinCutPool layer as presented in the 2020 ICML paper "Spectral Clustering with Graph Neural Networks for Graph Pooling"
https://arxiv.org/abs/1907.00481
MIT License
261 stars 48 forks source link

BUG when run Graph_Classification.py #3

Closed zeyuanyin closed 4 years ago

zeyuanyin commented 4 years ago

I do not modify the code in Graph_Classification.py. When I run Graph_Classification.py, bug is as follow:

Traceback (most recent call last):
  File "D:\Program Files\JetBrains\PyCharm 2019.3.3\plugins\python\helpers\pydev\pydevd.py", line 1448, in _exec
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "D:\Program Files\JetBrains\PyCharm 2019.3.3\plugins\python\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "C:/Users/YZY1037/Desktop/Spectral-Clustering-with-Graph-Neural-Networks-for-Graph-Pooling-master/Graph_Classification.py", line 105, in <module>
    A, X, y = get_graph_kernel_dataset(P['dataset_ID'], feat_norm='ohe')
  File "C:\Users\YZY1037\Desktop\Spectral-Clustering-with-Graph-Neural-Networks-for-Graph-Pooling-master\utils\dataset_loader.py", line 90, in get_graph_kernel_dataset
    nx_graphs, y = read_graphs_txt(dataset_ID)
  File "C:\Users\YZY1037\Desktop\Spectral-Clustering-with-Graph-Neural-Networks-for-Graph-Pooling-master\utils\dataset_loader.py", line 67, in read_graphs_txt
    g.node[n]['label'] = node_labels[i]
AttributeError: 'Graph' object has no attribute 'node'

I want to know why and how to solve it. Thanks.

danielegrattarola commented 4 years ago

Hi,

this looks like a problem with networkx. Can you try installing version 2.3 as specified in the requirements.txt? It should solve the issue.

All the best, Daniele

zeyuanyin commented 4 years ago

Thanks for your solution.