- The paper introduces a novel graph-based algorithm that outperforms traditional MBF methods in detecting both loop and non-loop arbitrage paths.
- It constructs a token graph and converts it into a line graph to efficiently apply a modified Moore-Bellman-Ford algorithm for enhanced arbitrage discovery.
- Empirical results show the method uncovers significantly more profitable opportunities, with profits reaching nearly one million dollars and reflecting cyclical market patterns.
Improved Algorithm for Identifying Arbitrage Opportunities on DEXs
Introduction
This research presents an enhanced algorithm specifically designed to identify arbitrage opportunities within the context of decentralized exchanges (DEXs), focusing primarily on Uniswap V2. DEXs like Uniswap form a crucial part of the decentralized finance (DeFi) ecosystem by enabling peer-to-peer token trading. However, price discrepancies between different liquidity pools provide opportunities for arbitrage which can be capitalized on but require advanced methodologies for effective detection.
Methodology
The proposed algorithm integrates the construction of a line graph based on an underlying token graph and employs a modified Moore-Bellman-Ford (MMBF) algorithm. This approach addresses the limitations of traditional MBF algorithms, which are inefficient in detecting non-loop arbitrage paths and can only identify a limited number of loops per run.
Token and Line Graph Construction
The token graph G(V,E,P) depicts tokens as nodes and liquidity pool exchange rates as edge weights. The line graph L(G), derived from G, represents paths as vertices, facilitating the efficient application of graph algorithms to find arbitrage opportunities.
Modified Moore-Bellman-Ford Algorithm
The MMBF algorithm is applied to this line graph for arbitrage detection. By introducing an additional starting node linked to a token's adjacent vertices, the algorithm efficiently computes the shortest path across all nodes, unveiling both loop and non-loop arbitrage opportunities. This approach streamlines computation by reducing complexity, as it consolidates node calculations and capitalizes on graph properties to pinpoint arbitrage paths.
Empirical Results
Arbitrage Path Length Distribution
The distribution of arbitrage path lengths shows that our method uncovers significantly more opportunities compared to the MBF combined algorithm. The majority of path lengths fall between 7 and 11, indicating diverse arbitrage scenarios beyond the capabilities of traditional methods.

Figure 1: Distribution of the length of arbitrage paths. Panel (a) depicts the distribution of arbitrage path length by our method, while panel (b) shows the MBF combined algorithm length distribution.
Profit Potential
Examination of potential arbitrage profits reveals substantial opportunities, with profits sometimes reaching nearly one million dollars—far surpassing the limits of previous algorithms, which capped at about one hundred thousand dollars. The profits detected follow a power-law distribution, predominantly lying within the hundreds, underscoring the efficacy of the proposed method in identifying lucrative paths.

Figure 2: Distribution of potential arbitrage profit in the token graph. Panel (a) depicts profits identified by our method; panel (b) depicts those by the MBF combined algorithm.
Temporal Analysis of Arbitrage Profit
Analyzing temporal data shows a cyclical pattern in potential arbitrage profits with noticeable fluctuations across time, peaking around late 2020. A declining trend in profits suggests increasing market efficiency over time as DEX mechanisms undergo arbitrage activities, aligning with economic expectations.
Figure 3: Potential profit from arbitrage by our method in Uniswap V2 with time.
Discussion
The advancement from using a traditional Moore-Bellman-Ford approach to the modified method proposed here represents a substantial step forward in arbitrage detection in decentralized exchanges. By addressing the limitations of previous algorithms and effectively discovering both loops and non-loop paths, the new approach not only identifies more opportunities but also optimizes input allocation for maximizing arbitrage profits.
This study heralds promising avenues for practical applications of automated trading strategies in token markets. Looking forward, the focus will be on optimizing computational efficiency and integrating transaction cost factors, such as gas fees, to further refine the model's applicability in real-time trading environments.
Conclusion
In conclusion, by refining the approach to arbitrage detection through a novel graph-based methodology, this research offers significant improvements to the identification of arbitrage opportunities in DEXs. The combination of a line graph structure with an enhanced MBF algorithm presents a robust solution to the challenges inherent in decentralized token trading markets, positioning this work as a valuable contribution to financial technology and blockchain research domains.