如何根据入度值对Cora数据集的节点进行聚类?
我想以每个集群只包含具有相同入度值的节点的方式对 Cora 数据集的节点进行集群。我可以编写如下代码:
import torch
from torch_geometric.datasets import Planetoid
from torch_geometric.utils import degree
dataset = Planetoid('./data','CORA')
data = dataset[0]
n = data.num_nodes
indegree = degree(data.edge_index[1], n, dtype=torch.long)
counts = torch.bincount(indegree)
但是由于我没有访问节点的索引值,所以不知道如何将每个节点放在哪个集群中?