Hello I am learning more about graph theory and was recently learning about Bellman Ford. I noticed an example of how Bellman Ford could be used to arbitrage markets and I took some time to understand this further but I am a little confused at if the graph for arbitrage is directed or undirected. For an arbitrage opportunity between two markets to be present, there needs to be a negative cycle. However, I was reading that Bellman Ford only works with directed graphs that have negative cycles or undirected graphs without negative cycles.
I came across this example where the rates are the edges in an adjacency matrix and the currencies are the vertices (please let me know if I am misunderstanding).
rates = [
[1, 0.23, 0.25, 16.43, 18.21, 4.94],
[4.34, 1, 1.11, 71.40, 79.09, 21.44],
[3.93, 0.90, 1, 64.52, 71.48, 19.37],
[0.061, 0.014, 0.015, 1, 1.11, 0.30],
[0.055, 0.013, 0.014, 0.90, 1, 0.27],
[0.20, 0.047, 0.052, 3.33, 3.69, 1],
]
currencies = ('PLN', 'EUR', 'USD', 'RUB', 'INR', 'MXN')
It looks like there is an edge to and from each vertex, which would make the graph undirected? There is probably something I am missing though as Bellman ford needs a directed graph to detect negative cycles.
Here is the article I was reading with the full code example. The code is close to the bottom of the article.
Can anyone help me understand what is going on here and if the graph is directed or undirected? If undirected, why does this work for arbitrage if it is looking for negative cycles?