A Line Graph-Based Framework for Identifying Optimal Routing Paths in Decentralized Exchanges
Yu Zhang, Yafei Li, Claudio Tessone
TL;DR
The paper tackles the problem of identifying profitable multi-hop trading paths across decentralized exchanges by introducing a line-graph-based framework (LG). It constructs a token graph from liquidity pools, transforms it into a line graph, and applies an LG routing algorithm that traverses the line graph to maximize output under CPMM rules, with a finite termination guaranteed even in arbitrage scenarios. Empirical results on Uniswap V2 data show that LG matches or surpasses DFS in profitability while maintaining comparable gas costs, though the method exhibits exponential runtime growth with graph size. The work demonstrates LG’s viability for real-world routing and sets the stage for potential deployment in DEX aggregators and further optimization to handle larger graphs.
Abstract
Decentralized exchanges, such as those employing constant product market makers (CPMMs) like Uniswap V2, play a crucial role in the blockchain ecosystem by enabling peer-to-peer token swaps without intermediaries. Despite the increasing volume of transactions, there remains limited research on identifying optimal trading paths across multiple DEXs. This paper presents a novel line-graph-based algorithm (LG) designed to efficiently discover profitable trading routes within DEX environments. We benchmark LG against the widely adopted Depth-First Search (DFS) algorithm under a linear routing scenario, encompassing platforms such as Uniswap, SushiSwap, and PancakeSwap. Experimental results demonstrate that LG consistently identifies trading paths that are as profitable as, or more profitable than, those found by DFS, while incurring comparable gas costs. Evaluations on Uniswap V2 token graphs across two temporal snapshots further validate LG's performance. Although LG exhibits exponential runtime growth with respect to graph size in empirical tests, it remains viable for practical, real-world use cases. Our findings underscore the potential of the LG algorithm for industrial adoption, offering tangible benefits to traders and market participants in the DeFi space.
