GraphEval36K: Benchmarking Coding and Reasoning Capabilities of Large Language Models on Graph Datasets

Qiming Wu, Zichen Chen, Will Corcoran, Misha Sra, Ambuj K. Singh

Abstract

Large Language Models (LLMs) have demonstrated remarkable proficiency in sequential text processing, yet their ability to reason over structured, non-linear data like graphs remains a significant challenge. This paper introduces GraphEval36K, a comprehensive benchmark designed to evaluate LLMs on graph-related coding tasks across diverse topologies and difficulty levels. Alongside the benchmark, the authors propose Structured Symbolic Decomposition (SSD), a prompting strategy that decomposes complex algorithmic problems into manageable cognitive steps. Experimental results show that SSD significantly enhances model performance, with gains of up to 29%, while highlighting a persistent "reasoning gap" in handling complex graph structures like Small-world and Power-law networks.

Introduction

While LLMs excel at general programming, they often struggle with the multi-step logic required for graph algorithms. Existing benchmarks frequently rely on simple natural language queries, failing to capture the complexity of real-world algorithmic challenges such as shortest path finding or topological sorting. LLMs frequently "hallucinate" non-existent connections or fail to account for specific graph constraints. GraphEval36K addresses this by providing a rigorous, code-centric evaluation framework.

Methodology

The research introduces a dual-pronged approach to improving and measuring graph reasoning:

  1. GraphEval36K Benchmark: A dataset comprising 40 core problems sourced from competitive programming platforms like LeetCode. These are augmented by 36,900 synthetic test cases generated across eight distinct graph topologies (e.g., Sparse, Planar, Small-world).
  2. Structured Symbolic Decomposition (SSD): A prompting method that guides LLMs through a four-stage workflow: Problem Clarification, Problem Breakdown, Solution Formulation, and Program Implementation. This structured approach mimics human problem-solving by separating planning from execution.
The GraphEval36K evaluation pipeline, illustrating the flow from input requirements through LLM processing to automated evaluation via GraphEval.

Benchmark Composition

GraphEval36K is uniquely focused on large-scale verification. The 40 problems are split between directed and undirected graphs, covering categories such as Topological Sort, Shortest Path, and Cycle Detection. The benchmark's strength lies in its diversity of problem types and the massive suite of test cases used to verify code correctness.

Distribution of problems in the GraphEval36K benchmark across various graph categories and difficulty levels.

Key Results and Insights

  • Prompting Power: SSD significantly improved the passing rates for models like Gemini-Pro (+29.28%) and Claude-3-Sonnet (+25.28%). Even high-performing models like GPT-4o saw substantial improvements on "Hard" problems, jumping from a 0% to a 66.67% success rate.
  • Model Performance: GPT-4o remains the leader, but open-source models like DeepSeek-V3 and Qwen-2.5-Coder are competitive, particularly on specific graph types like sparse and planar graphs.
  • Topological Sensitivity: Models perform better on directed graphs, likely due to the explicit hierarchy. However, they struggle with "Small-world" and "Power-law" graphs, which feature high clustering and complex connectivity.

Conclusion

GraphEval36K provides a vital tool for assessing the structural reasoning of LLMs. While SSD offers a powerful mitigation for planning failures, the benchmark reveals that current models still face fundamental hurdles with complex graph topologies. Future work will focus on expanding problem diversity to include flow networks and matching, as well as incorporating real-world datasets to move beyond synthetic graph generation.

Summary updated

BibTeX
@inproceedings{wu2025grapheval,
  author = {Qiming Wu and Zichen Chen and Will Corcoran and Misha Sra and Ambuj K. Singh},
  title = {{GraphEval36K: Benchmarking Coding and Reasoning Capabilities of Large Language Models on Graph Datasets}},
  booktitle = {Conference of the North American Chapter of the Association for Computational Linguistics},
  year = {2025},
  doi = {10.18653/v1/2025.findings-naacl.452},
}
Figure