Clustering the nodes of the Cora dataset #2819
-
I want to cluster the nodes of the Cora dataset based on the in-degree value of the nodes so that each cluster only contains the nodes with the same in-degree value. I know how to get the counts: from torch_geometric.datasets import Planetoid dataset = Planetoid('./data','CORA') But since I don't access the index value of the nodes, I don't know how to place each node in which cluster? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
How about using perm = indegree.argsort()
data.x = data.x[perm] For re-permuting edge indices, you can do: data.edge_index = perm[data.edge_index] |
Beta Was this translation helpful? Give feedback.
How about using
argsort()
to re-sort your data so that nodes with the same node degree have a contiguous memory layout? For example, for re-permuting the node features, you can do:For re-permuting edge indices, you can do: