Suppose there are n foreign exchange rates, and let denote vectors of the logarithmic returns of foreign exchange rates and respectively. The correlation coefficient matrix as in the lower triangular part of Chart A1 is then derived as follows (1999, Mantegna).

Chart A1: Correlation coefficient (lower triangular part), adjacency (red dots), and p-value (upper triangular part) matrix of logarithmic returns of daily bilateral exchange rates from 3 January 2005 to 29 December 2006

**Sources: Bank calculations, BIS, and Bloomberg**

As noted above, we can think of the foreign exchange market as a weighted graph where a finite set of vertices denotes foreign exchange rates while a finite set of edges connecting vertices represents correlation coefficients between the foreign exchange rates. In a weighted graph, the weight associated with each edge must be a positive real number, but correlation coefficients can be negative. We therefore transform the correlations into positive real number weights by the map, .

Since the transformation, , is bijective and monotonically decreasing, a spanning tree, , that minimises necessarily maximises . Thus an MST for the weights, , is a network of the most highly correlated foreign exchange rates by price return.

The number of spanning trees for a complete graph with vertices is . Thus, it would be computationally inefficient to consider all of the possible spanning trees to derive the MST. Instead, there are two widely used algorithms for deriving the MST, i.e., Prim’s and Kruscal’s. This blog uses the former to derive the MST. The MST has n-1 edges as shown in the adjacency matrix in Chart A1 where the red dots indicate that the corresponding foreign exchange rate pairs are connected in the MST.

This blog plots MSTs graphically using a force-directed graph-drawing algorithm called Kawai-Kamada. And in plotting a series of MSTs for the dynamic MST, the -coordinate layout of the previous network is used to calculate that of the new network such that changes in the layout of the dynamic MST is minimised – the author would like to thank Michael Woodford for coding this algorithm, and Will Dison and Tahir Mahmood for reviewing this annex.