Start with variable which has the largest distance between all other variables. Then add the variable with the largest distance to the already selected variables.
optimal_order(distance, selected = character(0))
a square distance matrix
optional vector of preselected variables
a vector variable names