A linkage matrix records agglomerative clustering as a sequence of merges. Each row identifies the two assets or prior clusters combined, the distance at which they join, and the size of the new cluster. Original assets use indices 0 through n−1; each merge creates a new cluster index for later rows. section 11.2.4
For hierarchical risk parity (HRP), the matrix turns pairwise asset distances into a cluster hierarchy. It is then read from the final merge backward: repeatedly expand cluster indices until only original asset indices remain, producing an ordering that places nearby assets together before recursive bisection assigns weights. section 11.2.4
Construct it incrementally:
- Start every asset as a one-item cluster and find the smallest remaining intercluster distance. section 11.2.4
- Merge that pair, record their indices, the minimum distance, and the combined cluster size. section 11.2.4
- Update distances for the new cluster and repeat until one cluster contains all assets. section 11.2.4
Eight-asset merge history
The first row merges assets 0 and 1 at distance 0.2951 into a cluster of size 2. A later row merges asset 3 with that new cluster, while the final row joins clusters 11 and 13 into the eight-asset cluster. section 11.2.4
link_mat
array([[ 0. , 1. , 0.29511716, 2. ],
[ 3. , 8. , 0.36912864, 3. ],
[ 5. , 9. , 0.40906463, 4. ],
[ 2. , 4. , 0.60430531, 2. ],
[ 6. , 10. , 0.70386939, 5. ],
[ 7. , 12. , 0.83002921, 6. ],
[11. , 13. , 0.90802712, 8. ]])
Inspect the four-column numerical merge history used to reconstruct the asset ordering. section 11.2.4
