Abstract
Graph-theoretic problems arise in real-world applications like logistics, communication networks, and traffic optimization. These problems are often complex, noisy, and irregular, posing challenges for traditional algorithms. Large language models offer potential solutions but face several challenges, including limited accuracy, input length constraints, and suboptimal algorithm selection. To address these challenges, we propose MA-GTS (Multi-Agent Graph Theory Solver), a multi-agent framework that decomposes these complex problems through agent collaboration. MA-GTS maps the implicitly expressed text-based graph data into clear, structured graph representations and dynamically selects the most suitable algorithm based on problem constraints and graph structure scale. We validate MA-GTS using the G-REAL dataset, a real-world-inspired graph theory dataset we created. Experimental results show that MA-GTS outperforms state-of-the-art methods in cost-effectiveness, accuracy, and scalability, achieving strong results on multiple benchmarks (G-REAL 93.6%, GraCoRe 96.9% NL-Graph 98.4%) with robust performance on both closed- and open-source base models.
Introduction
Graph theory is the backbone of modern logistics, network routing, and traffic optimization. However, a significant gap exists between clean textbook problems and real-world scenarios, which are often characterized by "textual noise"—irrelevant details, implicit structures, and non-standard naming conventions. While Large Language Models (LLMs) excel at understanding context, they struggle with the rigorous computation required for NP-hard graph problems due to reasoning limits, context constraints, and sensitivity to noise.
MA-GTS (Multi-Agent Graph Theory Solver) bridges this gap by orchestrating a team of specialized LLM agents. Instead of attempting to solve complex math directly, the framework transforms messy natural language into structured graph problems and solves them using surgical algorithmic precision.
Methodology: The MA-GTS Architecture
MA-GTS utilizes a hierarchical three-layer architecture designed to separate problem comprehension from mathematical execution. This modular approach allows the system to maintain the flexibility of natural language processing while leveraging the reliability of classical algorithms.
1. Information Extraction Layer (IEL)
This layer consists of three specialized agents—Textual, Problem, and Structure—that collaborate to filter noise. They identify the core problem type (e.g., Shortest Path or Traveling Salesman) and extract raw graph data from the input text.
2. Knowledge Integration Layer (KIL)
Acting as the system's architect, the Graph Theory Agent queries a specialized Knowledge Base to select the most efficient algorithm based on the graph's scale and constraints. It standardizes the extracted data into a clean digital format, such as an adjacency list.
3. Algorithm Execution Layer (AEL)
The "Engineer" agent retrieves the selected algorithm from a pre-built Python library and executes it via a code interpreter. A self-check mechanism ensures the final solution adheres to all original problem constraints.
Experimental Setup and Datasets
The framework was evaluated on three primary benchmarks:
- G-REAL: A new dataset simulating real-world scenarios (e.g., delivery logistics, Wi-Fi allocation) with heavy textual noise and randomized node names to prevent models from relying on prior knowledge.
- GraCoRe: A benchmark focused on graph comprehension and reasoning.
- NL-Graph: A dataset of graph problems expressed in natural language.
Results and Discussion
MA-GTS demonstrates superior performance across accuracy, cost-efficiency, and scalability metrics compared to state-of-the-art reasoning models like OpenAI’s o3-mini.
Accuracy and Scalability
On the complex G-REAL Traveling Salesman Problem (TSP) task, MA-GTS achieved 94.9% accuracy, whereas o3-mini (relying on internal Chain-of-Thought reasoning) achieved only 12.9%. Furthermore, while standard LLM performance typically plummets as graph size increases, MA-GTS remains stable because its underlying Python algorithms are not subject to the memory or logic fatigue inherent in neural networks.
Cost Efficiency
By delegating computation to code rather than internal reasoning tokens, MA-GTS is significantly more economical. For instance, in Vertex Cover problems, MA-GTS reduced inference costs by nearly 20x compared to o3-mini.
Conclusion
MA-GTS shifts the role of the LLM from a calculator to an orchestrator. By explicitly handling noise removal and delegating heavy lifting to a Python library, the framework achieves high accuracy even in cluttered real-world scenarios. Future work will focus on expanding the framework to even larger graphs and optimizing the tool-invocation capabilities of open-source models to match the performance of closed-source counterparts.
Summary updated