Scalable unsupervised alignment of general metric and non-metric structures