COO (coordinate) format stores sparse data by recording the coordinates and values of nonzero entries. For a graph, it represents a sparse adjacency matrix without allocating storage for every zero. section 7.5
Use COO representation when graph connectivity is sparse:
- Store only nonzero adjacency entries, reducing memory use when few vertices are connected. section 7.5
- Expect potentially slower computation than dense representation for particular tasks. section 7.5
- Convert dense adjacency matrices or edge indexes with PyG's ToSparseTensor or manually through PyTorch and SciPy sparse APIs. section 7.5
torch_geometric.transforms import ToSparseTensor dataset = YourDataset(transform=ToSparseTensor())
Apply ToSparseTensor as a dataset transform to construct a COO-based sparse adjacency representation. section 7.5
