SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2609.12265 · September 2026

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

Xiangliang Zhang, Yanbo Wang, Xiuying Chen, Yue Huang, Zhaorun Chen, Chenxi Wang, Lang Gao, Zirui Song, Zixiang Xu

arXiv · PDF · Open in the Atlas

Code that ran

7 of 14 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 6 failures of our instrument; 7 no recorded run), measured 2026-11-23; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2609.12265.json · badge: /api/ran/2609.12265.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
xzx34/GTA canonical (classifier label)
classifier basis: census
7 ran · 7 no recorded run
FunctionStatusWhere it lives
attributes Ran
ran; our contract draft was wrong, not the code
xzx34/GTA/src/gtbench/formats.py
code served (permissive licence) · get_code("fb9e59aac275392c")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

class Edge:
    def __init__(self, weight=None, capacity=None, cost=None):
        self.weight = weight
        self.capacity = capacity
        self.cost = cost

class Graph:
    def __init__(self, edges):
        self.edges = edges

# Create a graph with edges that have various attributes
edge1 = Edge(weight=1.5, capacity=10, cost=None)
edge2 = Edge(weight=None, capacity=20, cost=5.0)
edge3 = Edge(weight=2.0, capacity=None, cost=3.0)

graph = Graph(edges=[edge1, edge2, edge3])

ARGS = {
    'graph': graph
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
determinant Ran
ran, honoured the contract we drafted
xzx34/GTA/src/gtbench/solvers.py
code served (permissive licence) · get_code("be97d5a30ae5391c")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned int, ndim 0, dtype family int, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# The function computes the determinant of a matrix using Bareiss elimination
# It expects a matrix-like object (list of lists, or something iterable of rows)
# Each row should be iterable and contain integers

# Create a simple square matrix with integer entries
matrix = [
    [1, 2, 3],
    [4, 5, 6],
    [7, 8, 10]
]

ARGS = {
    "matrix": matrix
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
digest Ran
ran; our contract draft was wrong, not the code
xzx34/GTA/src/gtbench/data.py
code served (permissive licence) · get_code("6f7602f3af1e189f")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import hashlib
import json

def json_text(value):
    return json.dumps(value, ensure_ascii=False, sort_keys=True, separators=(',', ':'))

def digest(value):
    return hashlib.sha256(json_text(value).encode()).hexdigest()

# Analyzing the function:
# - digest(value) takes a single parameter 'value'
# - It converts value to JSON using json_text
# - json_text calls json.dumps on the value, so value must be JSON-serializable
# - The function returns a SHA256 hash hexdigest

# Valid test cases: dicts, lists, strings, numbers, booleans, None
# Using a simple dict with various JSON-serializable types

ARGS = {
    "value": {
        "name": "test",
        "count": 42,
        "active": True,
        "tags": ["a", "b", "c"],
        "score": 3.14,
        "metadata": None
    }
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
json_text Ran
ran; our contract draft was wrong, not the code
xzx34/GTA/src/gtbench/data.py
code served (permissive licence) · get_code("f5e2b9aa7af37032")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import json

def json_text(value):
    return json.dumps(value, ensure_ascii=False, sort_keys=True, separators=(',', ':'))

# The function takes a single parameter 'value' which can be any JSON-serializable object
# It calls json.dumps on it with specific parameters

ARGS = {
    'value': {
        'name': 'test',
        'count': 42,
        'items': [1, 2, 3],
        'nested': {'key': 'value'},
        'unicode': 'こんにちは'
    }
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
read_config Ran
ran; our contract draft was wrong, not the code
xzx34/GTA/src/gtbench/evaluate.py
code served (permissive licence) · get_code("bdaaccbb96c37a8e")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import tempfile
from pathlib import Path

# Create a temporary TOML configuration file with valid settings
with tempfile.NamedTemporaryFile(mode='w', suffix='.toml', delete=False, encoding='utf-8') as f:
    config_content = """
model = "gpt-4"
base_url = "https://api.openai.com/v1"
api_key_env = "OPENAI_API_KEY"
timeout = 30.0
attempts = 2
workers = 4

[parameters]
temperature = 0.5
top_p = 0.9
"""
    f.write(config_content)
    config_path = f.name

ARGS = {
    'path': config_path,
    'model': None,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
second_mst Ran
ran; our contract draft was wrong, not the code
xzx34/GTA/src/gtbench/solvers.py
code served (permissive licence) · get_code("633e68fffeaf19b3")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned int, ndim 0, dtype family int, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import math
import networkx as nx

# Create a connected graph with weighted edges
g = nx.Graph()

# Add edges with weights to form a graph
# We'll create a simple connected graph
edges = [
    (0, 1, {'weight': 1}),
    (1, 2, {'weight': 2}),
    (2, 3, {'weight': 3}),
    (0, 3, {'weight': 5}),
    (1, 3, {'weight': 4}),
]

g.add_edges_from(edges)

# Verify the graph is connected
assert nx.is_connected(g), "Graph must be connected for the function to work"

ARGS = {
    'g': g
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
networkx — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
spanning_tree_count Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
xzx34/GTA/src/gtbench/solvers.py
code served (permissive licence) · get_code("8aea140b5b8b6e24")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned int, ndim 0, dtype family int, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import networkx as nx

# Create a simple graph for testing spanning_tree_count
# The function expects a graph object with:
# - list() iteration over nodes
# - .degree(u) method for a node
# - .has_edge(u, v) method to check if edge exists

g = nx.Graph()
g.add_edges_from([(0, 1), (1, 2), (2, 0)])

ARGS = {
    "g": g
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
networkx — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
extract_answer Not yet run
unverified (harvested, no recorded run)
xzx34/GTA/src/gtbench/evaluate.py
code served (permissive licence) · get_code("0a5cb941be6403a6")
How it ran

no invocation recorded.

generate_dataset Not yet run
unverified (harvested, no recorded run)
xzx34/GTA/src/gtbench/generate.py
code served (permissive licence) · get_code("f9b6c86d13541248")
How it ran

no invocation recorded.

generate_graph Not yet run
unverified (harvested, no recorded run)
xzx34/GTA/src/gtbench/generate.py
code served (permissive licence) · get_code("a36efd4d6a7768ff")
How it ran

no invocation recorded.

generate_instance Not yet run
unverified (harvested, no recorded run)
xzx34/GTA/src/gtbench/generate.py
code served (permissive licence) · get_code("d6925f96db385b05")
How it ran

no invocation recorded.

get_task Not yet run
unverified (harvested, no recorded run)
xzx34/GTA/src/gtbench/tasks.py
code served (permissive licence) · get_code("61d7b30722025b3d")
How it ran

no invocation recorded.

make_record Not yet run
unverified (harvested, no recorded run)
xzx34/GTA/src/gtbench/data.py
code served (permissive licence) · get_code("7aa74ae08a432497")
How it ran

no invocation recorded.

score_examples Not yet run
unverified (harvested, no recorded run)
xzx34/GTA/src/gtbench/evaluate.py
code served (permissive licence) · get_code("04876e2b0114d507")
How it ran

no invocation recorded.

Also present in other papers' code

Of 14 samples lifted from this paper's linked repositories, 14 carry a function identity and 0 do not. Of the 14 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 14 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Large Language Models (LLMs) are increasingly asked to reason over structured data such as graphs, yet how reliably they can carry out multi-step graph algorithms in language remains unclear. Existing evaluations tend to use simple tasks on small graphs, to score code generation rather than reasoning over the graph itself, or to fix a single input format. We introduce Graph Theory Bench (GT Bench), a benchmark covering 24 classical graph problems in 44 task-structure settings, with over 100,000 examples across four representations: natural language, structured language, adjacency list, and adjacency matrix. Evaluating eight LLMs on GT Bench shows that accuracy is strongly tied to the input representation, that the best representation shifts with graph density, size, and topology as well as with the model, and that this sensitivity persists, attenuated, in the strongest reasoning models. Building on these observations, we propose the Graph Theory Agent (GTA), which pairs a preference-trained representation selector with plan-and-decompose scaffolding around a frozen executor LLM. GTA lifts Phi-4 from 53.5% to 69.1% on the benchmark's easy split and from 33.0% to 41.5% on its hard split, outperforming eight prompting and agent baselines, and transfers without retraining to GraCoRe and NLGraph. Code for benchmark generation and evaluation: https://github.com/xzx34/GTA. The project homepage is available at https://xzx34.github.io/gta/.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2609.12265")
get_code_for_paper("2609.12265")
have("2609.12265")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2609.12265.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2609.12265.svg)](https://syntology.ai/paper/2609.12265)

Connect an agent — have() is free.