data = Data(edge_index=edge_index)
data.num_nodes = edge_index.max().item() + 1
data.x = torch.eye(data.num_nodes, dtype=torch.float)
y = [0 if G.nodes[i]["club"] == "Mr. Hi" else 1 for i in G.nodes]
data.y = torch.tensor(y)
self.data, self.slices = self.collate([data])
After Change
edge_index = torch.stack([row, col], dim=0)
// Compute communities.
partition = community_louvain.best_partition(G)
y = torch.tensor([partition[i] for i in range(G.number_of_nodes())])
// Select a single training node for each community
// (we just use the first one).