Zero-shot Graph Reasoning via Retrieval Augmented Framework with LLMs

Hanqing Li, Kiran Sheena Jyothi, Henry Liang, Sharika Mahadevan, Diego Klabjan
9/16/2025
cs.AIcs.CL

No confident code implementation found for this paper. 5 possible matches can be shown below.

Abstract

We propose a new, training-free method, Graph Reasoning via Retrieval Augmented Framework (GRRAF), that harnesses retrieval-augmented generation (RAG) alongside the code-generation capabilities of large language models (LLMs) to address a wide range of graph reasoning tasks. In GRRAF, the target graph is stored in a graph database, and the LLM is prompted to generate executable code queries that retrieve the necessary information. This approach circumvents the limitations of existing methods that require extensive finetuning or depend on predefined algorithms, and it incorporates an error feedback loop with a time-out mechanism to ensure both correctness and efficiency. Experimental evaluations on the GraphInstruct dataset reveal that GRRAF achieves 100% accuracy on most graph reasoning tasks, including cycle detection, bipartite graph checks, shortest path computation, and maximum flow, while maintaining consistent token costs regardless of graph sizes. Imperfect but still very high performance is observed on subgraph matching. Notably, GRRAF scales effectively to large graphs with up to 10,000 nodes.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. 5 weaker matches are hidden by default — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{li2025zeroshot,
  title  = {Zero-shot Graph Reasoning via Retrieval Augmented Framework with LLMs},
  author = {Hanqing Li and Kiran Sheena Jyothi and Henry Liang and Sharika Mahadevan and Diego Klabjan},
  year   = {2025},
  eprint = {2509.12743},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2509.12743v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2509.12743.svg)](https://codeofpaper.com/paper/2509.12743)

Discussion