Monday 12 July 2021

How to cluster the nodes of the Cora dataset based on their in-degree values?

I want to cluster the nodes of Cora dataset in a way that each cluster only contains the nodes with the same in-degree value. I can code something as follows:

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)

But since I don't access the index value of the nodes, I don't know how to place each node in which cluster?



from How to cluster the nodes of the Cora dataset based on their in-degree values?

No comments:

Post a Comment