# Achieving a well-diversified portfolio based on Graph Theory

### Gonzalo Sainz Ponce

#### 05/05/2022

Graph Theory is widely used in almost every area of interest for visualization or analysis purposes but, for some reason, it is not usually applied in finance. Why not trying to take advantage of its potential in portfolio management?

## Introduction

Current uncertainty is causing very pronounced movements in financial markets, so having a well-diversified portfolio is now more important than ever. As you know, diversification reduces risk by investing in assets that are not perfectly correlated, i.e. that behave differently in the face of market events.

Traditional literature gathers several diversification techniques in portfolio management, but in this post we are going to introduce a not very well-known one based on Graph Theory, a branch of mathematics concerned with networks of points connected by lines. Before going on, if you want to review some concepts about graphs you can take a look at this previous post.

Anyway, let us quickly recall that a graph is composed of nodes and edges which, in our case, will be the assets and the correlations between them respectively. Therefore, we will be dealing with a weighted graph in which the degree of a node (asset) will be the sum of the weights (correlations) of the incident edges. Moreover, given a graph, an independent vertex set is a subset in which no two nodes are adjacent (there’s no edge joining them).

As we can see in the image above, the independent vertex set of a graph does not have to be unique, so we will select ours using the Degeneracy Ordering methodology, which is summarized as follows:

• The node with the lowest degree in the network is chosen.
• If the selected node is not adjacent to one that is already in the set of independent nodes, it is included in the set.
• This process is repeated until all nodes have been analyzed.

In particular, we will apply the methodology described above to the assets that have comprised the Euro Stoxx 300 from 2006 to 2020. Assuming that over the long term the index tends to do well, the idea is to select assets from the index that are as uncorrelated as possible to reduce risk but maintain returns.

Note that there may be assets that are practically uncorrelated with any other, so to ensure that we choose them, we will set a threshold that the correlation between two assets must exceed for there to be an edge linking them. This means that our portfolio will be formed by these assets that are left alone and those of the constructed graph selected by the Degeneracy Ordering methodology (all with same weight). The portfolio will be re-balanced at the beginning of each year taking into account the components of the index at that time. In addition to this threshold, we will also consider as a parameter the number of previous years considered when calculating the correlations between assets.

Once we have understood how we are going to proceed, we can split the data into train dataset (2006-2015) and test dataset (2016-2020). We will use the train dataset to choose the combination of the two previous parameters that gives the highest annualized Sharpe Ratio and, then, we will see how this combination behaves in the test one.

## In-Sample results

The results obtained in the different simulations on the train dataset are shown in the following graphs in which the X axis represents the number of years considered to calculate the correlations (1, 2 or 3 years) and the Y axis the threshold (correlation) from which an edge is created between two nodes (0.2, 0.3 or 0.4). Note that the value on the left graph is the annualized Sharpe Ratio while the one on the right is the average number of assets in the portfolio.

Looking at the results shown above, we are left with the combination of a 1-year and a 0.3-threshold resulting in an annualized Sharpe Ratio of 0.63. As additional information, it shows that on average we would have had 52 assets in the portfolio. Let us compare this strategy with the index and an equally weighted (E-W) portfolio of the index constituents at the beginning of the year.

## Out-of-Sample results

There is no doubt that in-sample results are very promising both in terms of profitability and risk, but will the strategy be able to maintain such good results in the test dataset? Let’s find out!

Even if there is not as much difference as before, our portfolio is still the best in all metrics. It looks like the strategy is working!

## Conclusion

The idea of this post was to show the potential that Graph Theory can have in portfolio management. In fact, it seems that we have managed to design a strategy that systematically builds a diversified and consistent portfolio based on it. However, for sure this strategy still has a lot of room for improvement. For example, other parameters of even other Graph Theory concepts could be introduced. Good luck!