rusty1s / pytorch_cluster

PyTorch Extension Library of Optimized Graph Cluster Algorithms
MIT License
815 stars 146 forks source link

Add Haversine distance metric #226

Open mishooax opened 1 month ago

mishooax commented 1 month ago

The Haversine (great-circle) distance metric would be IMO a very useful addition. It'd allow for better clustering of points residing on a sphere (particularly for point / node configurations where the Euclidean distance metric is not a good approximation):

https://scikit-learn.org/stable/modules/generated/sklearn.metrics.pairwise.haversine_distances.html

I have written a hacky implementation (which essentially replaces the cosine similarity metric with the Haversine), that I can share if anyone would find it useful. But maybe we could find a better way to integrate this in the torch-cluster API, if there is interest?