P-GNN icon indicating copy to clipboard operation
P-GNN copied to clipboard

AttributeError: 'Graph' object has no attribute 'selfloop_edges'

Open supriya-gdptl opened this issue 4 years ago • 1 comments

Hello @JiaxuanYou, Thank you for the code. I am trying to run python main.py --model PGNN --layer_num 2 --dataset grid However, it gives the following error:

File "main.py", line 51, in <module>
    data_list = get_tg_dataset(args, dataset_name, use_cache=args.cache, remove_feature=args.rm_feature)
File "P-GNN/dataset.py", line 36, in get_tg_dataset
    dataset = load_tg_dataset(dataset_name)
File "P-GNN/dataset.py", line 387, in load_tg_dataset
    return nx_to_tg_data(graphs, features, edge_labels)
File "P-GNN/dataset.py", line 134, in nx_to_tg_data
    graph.remove_edges_from(graph.selfloop_edges())
AttributeError: 'Graph' object has no attribute 'selfloop_edges'

Could you please help me resolve this error? Thank you, Supriya

supriya-gdptl avatar Apr 23 '20 21:04 supriya-gdptl

Hello @JiaxuanYou, Thank you for the code. I am trying to run python main.py --model PGNN --layer_num 2 --dataset grid However, it gives the following error:

File "main.py", line 51, in <module>
    data_list = get_tg_dataset(args, dataset_name, use_cache=args.cache, remove_feature=args.rm_feature)
File "P-GNN/dataset.py", line 36, in get_tg_dataset
    dataset = load_tg_dataset(dataset_name)
File "P-GNN/dataset.py", line 387, in load_tg_dataset
    return nx_to_tg_data(graphs, features, edge_labels)
File "P-GNN/dataset.py", line 134, in nx_to_tg_data
    graph.remove_edges_from(graph.selfloop_edges())
AttributeError: 'Graph' object has no attribute 'selfloop_edges'

Could you please help me resolve this error? Thank you, Supriya

You can use nx.selfloop_edges(graph) instead of graph.selfloop_edges().

dreamhomes avatar May 24 '20 13:05 dreamhomes