paulmorio / geo2dr

Geo2DR: A Python and PyTorch library for learning distributed representations of graphs.
https://geo2dr.readthedocs.io/en/latest/
MIT License
45 stars 5 forks source link

weisfeiler_lehman_patterns.py Typerror: 'method' is not subscriptable #4

Closed kevinkorfmann closed 3 years ago

kevinkorfmann commented 3 years ago

Hi all, while learning about the sub-graph extractions. I ran across this error, when testing the file: Only modification i did was to modify the file path line to ip_folder ="../../examples/data/MUTAG" in the ifname == "main__": part. Using networkx==1.1, btw.

python weisfeiler_lehman_patterns.py

(base) decomposition(master) ✗: python weisfeiler_lehman_patterns.py Loaded 188 files in total

... Loading graphs

100%|███████████████████████████████████████| 188/188 [00:00<00:00, 1617.86it/s]

... Loaded all the graphs

Traceback (most recent call last): File "weisfeiler_lehman_patterns.py", line 295, in corpus, vocabulary, prob_map, num_graphs, graph_map = wl_corpus(all_files, max_h) File "weisfeiler_lehman_patterns.py", line 236, in wl_corpus graphs = [initial_relabel(g, node_label_attr_name) for g in graphs] File "weisfeiler_lehman_patterns.py", line 236, in graphs = [initial_relabel(g, node_label_attr_name) for g in graphs] File "weisfeiler_lehman_patterns.py", line 52, in initial_relabel for node in graph.nodes(): graph.nodes[node]['relabel'] = {} # make a dictionary attribute TypeError: 'method' object is not subscriptable (base) decomposition(master) ✗:

Thank you for writing this awesome package :+1:

kevinkorfmann commented 3 years ago

Installing networkx==2.6.2 fixed the problem.