()
| 90 | |
| 91 | |
| 92 | def load_data(): |
| 93 | dataset = CoraGraphDataset() |
| 94 | |
| 95 | graph = dataset[0] |
| 96 | # The paper created a hypergraph from the original graph. For each node in |
| 97 | # the original graph, a hyperedge in the hypergraph is created to connect |
| 98 | # its neighbors and itself. In this case, the incidence matrix of the |
| 99 | # hypergraph is the same as the adjacency matrix of the original graph (with |
| 100 | # self-loops). |
| 101 | # We follow the paper and assume that the rows of the incidence matrix |
| 102 | # are for nodes and the columns are for edges. |
| 103 | indices = torch.stack(graph.edges()) |
| 104 | H = dglsp.spmatrix(indices) |
| 105 | H = H + dglsp.identity(H.shape) |
| 106 | |
| 107 | X = graph.ndata["feat"] |
| 108 | Y = graph.ndata["label"] |
| 109 | train_mask = graph.ndata["train_mask"] |
| 110 | val_mask = graph.ndata["val_mask"] |
| 111 | test_mask = graph.ndata["test_mask"] |
| 112 | return H, X, Y, dataset.num_classes, train_mask, val_mask, test_mask |
| 113 | |
| 114 | |
| 115 | def main(args): |
no test coverage detected