);

            edge.id = jukeboxData.allEdges.length;
            jukeboxData.allEdges.push(edge);
        }
    }

    function precalculateNearestNeighbors(type, maxNeighbors, maxThreshold) {
        // skip if this is already done
        if ('all_neighbors' in track.analysis[type][0]) {
            return;
        }
        jukeboxData.allEdges = [];
        for (var qi = 0; qi < track.analysis[type].length; qi++) {
            var q1 = track.analysis[type][qi];
            calculateNearestNeighborsFor