proposeCoordinates

fun DistancesModel.proposeCoordinates(width: Double = 800.0, height: Double = 500.0, margin: Double = 60.0): Map<String, LayoutPoint>(source)

Proposes 2-D coordinates for the named locations of this DistancesModel via classical (Torgerson) multidimensional scaling (8K.6b) — so a coordinate-free distance model can be placed in a layout without hand-picking coordinates that honor the distance matrix. The directed matrix is symmetrized and, for a sparse model (one that defines only some pairs, e.g. a tandem line), completed by shortest paths; coordinates are uniformly scaled (shape-preserving) and centered to fit a width × height box with margin padding. MDS is rotation/reflection-invariant, so orientation is arbitrary.

Uses Hipparchus for the eigendecomposition of the double-centered matrix.