MCPcopy Index your code
hub / github.com/dmlc/dgl / load_data

Function load_data

examples/sparse/hypergraphatt.py:92–112  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

90
91
92def 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
115def main(args):

Callers 1

mainFunction · 0.70

Calls 2

CoraGraphDatasetClass · 0.90
edgesMethod · 0.45

Tested by

no test coverage detected