# Data structures This project relies on specific data structures for manipulating hierarchical partitions. As a basic user, you will most likely be exposed to `Data` and `NAG`. As you go deeper into the project, you may need to familiarize yourself with `CSRData`, `Cluster`, `InstanceData`, and all the associated batching structures. ## `Data` A `Data` object stores a single-level graph. It inherits from `torch_geometric`'s `Data` and has a similar behavior (see the [official documentation](https://pytorch-geometric.readthedocs.io/en/latest/generated/torch_geometric.data.Data.html#torch_geometric.data.Data) for more on this). Similar to `torch_geometric`'s `Data`: - `Data.pos` holds node positions - `Data.x` holds node features - `Data.y` holds node labels - `Data.edge_index` holds edges between nodes - `Data.edge_attr` holds edge features Important additional specificities of our `Data` object are: - `Data.super_index` holds, for each node, the index of the parent node (ie superpoint) in the partition level above. Said otherwise, `super_index` allows mapping from $P_i$ to $P_{i+1}$. - `Data.sub` holds a `Cluster` object indicating, for each node, the children nodes in the partition level below. Said otherwise, `sub` allows mapping from $P_i$ to $P_{i-1}$. - `Data.to_trimmed()` works like `torch_geometric`'s `Data.coalesce()` with the additional constraint that (i,j) and (j,i) edges are considered duplicates - `Data.save()` and `Data.load()` allow optimized, memory-friendly I/O operations - `Data.select()` indexes the nodes à la numpy - `Data.show()` for interactive visualization (see [visualization documentation](docs/visualization.md)) The `Batch` class allows for batching `Data` objects together, while preserving their advanced mechanisms without index collisions. ## `NAG` `NAG` (Nested Acyclic Graph) stores the hierarchical partition in the form of a list of `Data` objects. Important specificities of our `Data` object are: - `NAG[i]` returns a `Data` object holding the partition level `ì` - `NAG.get_super_index()` returns the index mapping nodes from any level `i` to `j` with `i