This is a Fortran implementation of the weighted SMACOF algorithm. It has a Python interface which is intended to be used with f2py3.
This software is provided as-is and probably needs modification to fit in any existing workflow.
SMACOF is an algorithm meant to embed a decorated graph in some Euclidean space. The embedding is constructed such that the following stress function is minimized:
Here G is a graph, E(G) are its edges, which are all decorated with a length l_e(G) and a weight w_e, and the intent is to let the length l_e(X) of the embedded edge correspond as closely as possible to the 'exact' length l_e(G).
Many existing open implementations of SMACOF do not allow for the weights to differ from 1 or even for the lengths to differ from the unit graph distance.
One possible use of the weighted algorithm is to try to find an 'isometric' embedding of a graph on a non-Euclidean manifold into some Euclidean space. 'Isometric' is meant here in the sense of Riemannian geometry, that is, locally.
For example, consider a set of points on the sphere labeled with their great-circle distance. A locally isometric embedding into \R^3 clearly exists, but the Euclidean distance between points disagrees more strongly with the great-circle distance as the points considered are farther apart. Weighing the edges by their length (e.g. w_e = \exp{-l_e(G)}) allows for the nonlocal distances to stop distorting the embedding and, thus, for the algorithm to recover the sphere in the limit of sufficiently dense point sets.
Compilation:
f2py3 -c smacof.f90 -m smacof_numerical
Then run python3 -i smacof.py
.
Details of the algorithm can be found in Modern Multidimensional Scaling: Theory and Applications (Borg, Groenen), chapter 8.