My data object has the data.adj_t parameter, giving me the sparse adjacency matrix. How can I get the edge_index tensor of size [2, num_edges] from this?
My data object has the data.adj_t parameter, giving me the sparse adjacency matrix. How can I get the edge_index tensor of size [2, num_edges] from this?
As you can see in the docs:
Since this feature is still experimental, some operations, e.g., graph pooling methods, may still require you to input the
edge_indexformat. You can convertadj_tback to(edge_index, edge_attr)via:row, col, edge_attr = adj_t.t().coo() edge_index = torch.stack([row, col], dim=0)