def process(self):
    base = get_dataset(name=self.name, use_lcc=self.use_lcc)
    adj_matrix = get_adj_matrix(base)
    heat_matrix = get_heat_matrix(adj_matrix, t=self.t)
    if self.k:
        print(f'Selecting top {self.k} edges per node.')
        heat_matrix = get_top_k_matrix(heat_matrix, k=self.k)
    elif self.eps:
        print(f'Selecting edges with weight greater than {self.eps}.')
        heat_matrix = get_clipped_matrix(heat_matrix, eps=self.eps)
    else:
        raise ValueError
    edges_i = []
    edges_j = []
    edge_attr = []
    for (i, row) in enumerate(heat_matrix):
        for j in np.where((row > 0))[0]:
            edges_i.append(i)
            edges_j.append(j)
            edge_attr.append(heat_matrix[(i, j)])
    edge_index = [edges_i, edges_j]
    data = Data(x=base.data.x, edge_index=torch.LongTensor(edge_index), edge_attr=torch.FloatTensor(edge_attr), y=base.data.y, train_mask=torch.zeros(base.data.train_mask.size()[0], dtype=torch.bool), test_mask=torch.zeros(base.data.test_mask.size()[0], dtype=torch.bool), val_mask=torch.zeros(base.data.val_mask.size()[0], dtype=torch.bool))
    (data, slices) = self.collate([data])
    torch.save((data, slices), self.processed_paths[0])
def process(self):
    base = get_dataset(name=self.name, use_lcc=self.use_lcc)
    adj_matrix = get_adj_matrix(base)
    heat_matrix = get_heat_matrix(adj_matrix, t=self.t)
    if self.k:
        print(f'Selecting top {self.k} edges per node.')
        heat_matrix = get_top_k_matrix(heat_matrix, k=self.k)
    elif self.eps:
        print(f'Selecting edges with weight greater than {self.eps}.')
        heat_matrix = get_clipped_matrix(heat_matrix, eps=self.eps)
    else:
        raise ValueError
    edges_i = []
    edges_j = []
    edge_attr = []
    for (i, row) in enumerate(heat_matrix):
        for j in np.where((row > 0))[0]:
            edges_i.append(i)
            edges_j.append(j)
            edge_attr.append(heat_matrix[(i, j)])
    edge_index = [edges_i, edges_j]
    data = Data(x=base.data.x, edge_index=torch.LongTensor(edge_index), edge_attr=torch.FloatTensor(edge_attr), y=base.data.y, train_mask=torch.zeros(base.data.train_mask.size()[0], dtype=torch.bool), test_mask=torch.zeros(base.data.test_mask.size()[0], dtype=torch.bool), val_mask=torch.zeros(base.data.val_mask.size()[0], dtype=torch.bool))
    (data, slices) = self.collate([data])
    torch.save((data, slices), self.processed_paths[0])