test_saint.py 329 Bytes
Newer Older
rusty1s's avatar
rusty1s committed
1
2
3
4
import torch
from torch_sparse.tensor import SparseTensor


rusty1s's avatar
rusty1s committed
5
def test_saint_subgraph():
rusty1s's avatar
rusty1s committed
6
7
    row = torch.tensor([0, 0, 1, 1, 2, 2, 2, 3, 3, 4])
    col = torch.tensor([1, 2, 0, 2, 0, 1, 3, 2, 4, 3])
rusty1s's avatar
rusty1s committed
8
    adj = SparseTensor(row=row, col=col)
rusty1s's avatar
rusty1s committed
9
10
    node_idx = torch.tensor([0, 1, 2])

rusty1s's avatar
rusty1s committed
11
    adj, edge_index = adj.saint_subgraph(node_idx)