cs.SEFeb 20, 2026

GraphSkill: Documentation-Guided Hierarchical Retrieval-Augmented Coding for Complex Graph Reasoning

Authors: Fali Wang, Chenglin Weng, Xianren Zhang, Siyuan Hong, Hui Liu, Suhang Wang

Organizations: The Pennsylvania State University, University Park, Pennsylvania, USA · Michigan State University, East Lansing, Michigan, USA

Abstract

The growing demand for automated graph algorithm reasoning has attracted increasing attention in the large language model (LLM) community. Recent LLM-based graph reasoning methods typically decouple task descriptions from graph data, generate executable code augmented by retrieval from technical documentation, and refine the code through debugging. However, we identify two key limitations in existing approaches: (i) they treat technical documentation as flat text collections and ignore its hierarchical structure, leading to noisy retrieval that degrades code generation quality; and (ii) their debugging mechanisms focus primarily on runtime errors, yet ignore more critical logical errors. To address them, we propose {\method}, an agentic hierarchical retrieval-augmented coding framework that exploits the document hierarchy through top-down traversal and early pruning, together with a self-debugging coding agent that iteratively refines code using automatically generated small-scale test cases. To enable comprehensive evaluation of complex graph reasoning, we introduce a new dataset, {\dataset}, covering small-scale, large-scale, and composite graph reasoning tasks. Extensive experiments demonstrate that our method achieves higher task accuracy and lower inference cost compared to baselines\footnote{The code is available at blue{https://github.com/FairyFali/GraphSkill}.}.

Figures & tables

Appendix figures & tables7 assets

Supplementary material from the paper’s appendix.

Appendix

Explore similar work

CardsList
  1. Unified Multi-Dimensional Benchmark for Complex Graph Reasoning in Large Language Models

    Aug 2, 2026Fali Wang, Ali Al-Lawati, Iliyas Bektas +5LLM EvaluationLLM Reasoning with Graphs

  2. GraphScout: Empowering Large Language Models with Intrinsic Exploration Ability for Agentic Graph Reasoning

    Mar 2, 2026Yuchen Ying, Weiqi Jiang, Tongya Zheng +4LLM Reasoning with GraphsAgentic RAG

  3. GTA: Graph Theory Agent and Benchmark for Algorithmic Graph Reasoning with LLMs

    Sep 10, 2026Zixiang Xu, Yanbo Wang, Chenxi Wang +6LLM Reasoning with GraphsLLM Agents