Skip to main content

Module memory_efficient

Module memory_efficient 

Source
Expand description

Memory-efficient graph operations: sparse COO representations, graph Laplacians, adaptive coarsening, and chunked neighbor aggregation. Memory-efficient graph operations.

This module provides utilities that keep memory usage proportional to the number of edges rather than the number of node pairs:

  • SparseGraph stores a graph in coordinate (COO) form, extracting only the non-negligible entries of a dense adjacency matrix.
  • sparse_laplacian builds the (optionally symmetric-normalized) graph Laplacian directly in COO form without ever materializing the dense num_nodes x num_nodes matrix.
  • adaptive_coarsening reduces a graph to a target number of supernodes using greedy edge-contraction (union-find), averaging the node features of each contracted cluster.
  • chunked_neighbor_aggregation performs mean neighbor aggregation using a sparse adjacency list (O(E) memory) and processes destination nodes in bounded-size chunks for cache locality.

Structs§

SparseGraph
Sparse coordinate (COO) representation of a graph or graph operator.

Functions§

adaptive_coarsening
Coarsen graph down to at most target_nodes supernodes.
chunked_neighbor_aggregation
Mean-aggregate each node’s neighbor features.
sparse_laplacian
Build the graph Laplacian directly in sparse COO form.