Our new X account is live! Follow @wizwand_team for updates
WorkDL logo mark

Colorful Talks with Graphs: Human-Interpretable Graph Encodings for Large Language Models

About

Graph problems are fundamentally challenging for large language models (LLMs). While LLMs excel at processing unstructured text, graph tasks require reasoning over explicit structure, permutation invariance, and computationally complex relationships, creating a mismatch with the representations of text-based models. Our work investigates how LLMs can be effectively applied to graph problems despite these barriers. We introduce a human-interpretable structural encoding strategy for graph-to-text translation that injects graph structure directly into natural language prompts. Our method involves computing a variant of Weisfeiler-Lehman (WL) similarity classes and maps them to human-like color tokens rather than numeric labels. The key insight is that semantically meaningful and human-interpretable cues may be more effectively processed by LLMs than opaque symbolic encoding. Experimental results on multiple algorithmic and predictive graph tasks show the considerable improvements by our method on both synthetic and real-world datasets. By capturing both local and global-range dependencies, our method enhances LLM performance especially on graph tasks that require reasoning over global graph structure.

Angelo Zangari, Peyman Baghershahi, Sourav Medya• 2026

Related benchmarks

TaskDatasetResultRank
Cycle CheckBA and ER averaged (test)
Accuracy93
5
Shortest PathBA and ER averaged (test)
Accuracy91.87
5
Maximum FlowBA and ER averaged (test)
Accuracy36.59
5
Triangle CountingBA and ER averaged (test)
Accuracy14.5
5
Node ClassificationCora 150 subgraphs total (30 sampled)
Macro F10.223
4
Node ClassificationCiteseer 150 subgraphs total (30 sampled)
F1-Macro20.08
4
Node ClassificationPubMed 150 subgraphs total (30 sampled)
F1-Macro14.33
4
Node ClassificationOGBN-ArXiv 150 subgraphs total (30 sampled)
F1-Macro40.94
4
Showing 8 of 8 rows

Other info

Follow for update