Optic Algorithm Imlementation in pytorch

hey, I am new to pytorch
I want to implement optic algorithm to cluster the sample in pytorch. Also, Optic algorithm is a density based hierarchical clustering algorithm. I don’t want recursive hierarchy just want largest cluster spatially separated from other clusters. And want to label that larget cluster as + training samples