39    landmarks.
edges.clear();
 
   49    std::map<std::pair<size_t, size_t>, 
float> nn;
 
   52    std::vector<std::pair<float, size_t>> inn(kns + 1);
 
   53    for (
size_t i = 0; i < landmarks.
n_landmarks(); ++i) {
 
   55        for (
size_t j = 0; j < landmarks.
n_landmarks(); ++j) {
 
   59            for (
size_t di = 0; di < landmarks.
d; ++di)
 
   63            if (nns && inn[nns - 1].first <= sqd)
 
   65            inn[nns] = { sqd, j };
 
   66            for (
size_t ni = nns; ni > 0; --ni) {
 
   67                if (inn[ni].first < inn[ni - 1].first)
 
   68                    inn[ni].swap(inn[ni - 1]);
 
   76        for (
size_t ni = 0; ni < nns; ++ni)
 
   77            nn[{ std::min(i, inn[ni].second), std::max(i, inn[ni].second) }] =
 
   84    std::vector<bool> visited(landmarks.
n_landmarks(), 
false);
 
   85    std::set<std::tuple<float, size_t, size_t>> q;
 
   86    q.insert({ 0, 0, 0 });
 
   88        auto [curdist, cur, from] = *q.begin();
 
   96            nn[{ std::min(cur, from), std::max(cur, from) }] = sqrt(curdist);
 
   98        for (
size_t i = 0; i < landmarks.
n_landmarks(); ++i) {
 
  102            for (
size_t di = 0; di < landmarks.
d; ++di)
 
  106            q.insert({ sqd, i, cur });
 
  111    for (
auto &&p : nn) {
 
  112        landmarks.
edges.push_back(p.first);
 
  113        landmarks.
edge_lengths.push_back(0.05 * sqrt(p.second)); 
 
constexpr float sqr(float x)
 
void make_knn_edges(KnnEdgesData &data, LandmarkModel &landmarks, const size_t kns)
 
Model of the high- and low-dimensional landmarks.
 
size_t n_landmarks() const
Reurns number of the 2D landmarks.
 
std::vector< float > hidim_vertices
One-dimensional array storing d-dimensional landmark coordinates in row-major order.
 
std::vector< float > edge_lengths
Lengths of all edges.
 
std::vector< std::pair< size_t, size_t > > edges
Array of vertex ID pairs.