Skip to content

Spatial graphs

Nearest neighbors and radius search, batch-aware, to build graphs from point coordinates or node features. Also available from mlx_graphs.nn.

Function Description
knn() Finds for each point of y the k nearest points of x.
knn_graph() Computes the graph connecting each point to its k nearest points.
radius() Finds for each point of y the points of x within distance r.
radius_graph() Computes the graph connecting each point to the points within distance r.

Sampling and clustering of point clouds and graphs:

Function Description
fps() Farthest point sampling, from the "PointNet++: Deep Hierarchical Feature Learning on Point Sets in a Metric Space" paper.
voxel_grid() Voxel grid pooling from the "Dynamic Edge-Conditioned Filters in Convolutional Networks on Graphs" paper: overlays a regular grid of user-defined size over a point cloud and clusters all the points within the same voxel.
nearest() Assigns each point of x to its nearest point of y, in the same graph.
graclus() A greedy clustering algorithm from the "Weighted Graph Cuts without Eigenvectors: A Multilevel Approach" paper, which matches each node with one of its unmarked neighbors (the one maximizing the edge weight, if given).
consecutive_cluster() Relabels cluster ids to consecutive integers.