

In the clustering process the spatial variance (SV) is computed between each endpoint (k) along trajectory (j) within its cluster (i):
Clustering starts by assigning each trajectory to its own cluster, so that there are i clusters with j=1 trajectories in each cluster. In each iteration the cluster number is reduced by one as two clusters are merged together. So that after the 2nd iteration there will be i1 clusters consisting of one cluster with two trajectories and the remainder with one trajectory. This process continues until only one cluster remains. With each iteration, the TSV is computed for each cluster merge combination, that is the trajectories in cluster 1 are added to those in cluster 2, cluster 3, and so on, until the TSV is computed for all remaining cluster combinations, resulting in (i^{2}i)/2 computations per iteration. The combination with the minimum TSV is passed on to the next iteration. This process continues until there is only one cluster. Large groups of trajectories could take quite some time to complete the clustering process. Initially the TSV rises dramatically, then levels off for the remaining iterations until near the end of the computation, at which point disparate clusters start to be merged and the TSV goes up again. The ideal final number of clusters would be prior to the point of rise. 