rusty1s / pytorch_cluster

PyTorch Extension Library of Optimized Graph Cluster Algorithms
MIT License
824 stars 148 forks source link

Add Haversine distance metric #226

Open mishooax opened 2 months ago

mishooax commented 2 months 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?