# graph-coloring

> Color a small graph with three colors so that no edge joins two nodes of the same color.

Source: https://nodus-platform-site.pages.dev/docs/reference/environments/graph-coloring/
Build revision: 211ad9f836655b1c3a2668c4693e442471f28614

<!-- Generated by tools/catalogdocs from catalog/objects. Do not edit: run make gen. -->

Color a small graph with three colors so that no edge joins two nodes of the same color.

|Field|Value|
|-|-|
|Reference|`nodus/graph-coloring@1.0.0`|
|Image|`nodus/env-graph-coloring:1.0.0`|
|Publisher|Nodus|
|Category|Reasoning|
|Readiness|Stable|
|Modes|Train, Evaluate|
|Reward|Binary|
|Held-out measures|TrainedTask|
|Splits|200 train, 64 test (disjoint by canonical identity)|
|Licenses|code Apache-2.0, data Apache-2.0|
|Source|<https://github.com/nodus-compute/nodus-platform/tree/main/images/environments>|

## Grading

Completions are graded by the platform, never by the trainer: the trainer submits `{taskId, completion}` batches and the verdicts come back as task events.

|Grader|Kind|What it checks|
|-|-|-|
|`proper-coloring`|Program|Checks every edge joins two different colors; any proper coloring is correct|

## Sample task

One line of `nodus-env tasks --split test --seed 0`; tasks never carry answers.

```json
{
  "metadata": {
    "edges": 12,
    "nodes": 7
  },
  "prompt": "A graph has 7 nodes numbered 0 to 6 and these edges: 0-1, 0-2, 0-4, 1-3, 1-6, 2-3, 2-4, 2-5, 3-4, 3-5, 3-6, 4-6.\nAssign each node one of the colors 0, 1 or 2 so that no edge connects two nodes of the same color.\nAnswer with the colors of nodes 0 to 6 in order, like \u003canswer\u003e[0, 1, 2, 0]\u003c/answer\u003e.",
  "taskId": "graph-coloring:test:0:0"
}
```

## Examples

Each example is a TrainingJob template. A baseline is shown only where the example was measured by running it.

|Example|Mode|Runtime|Model|Tasks|Baseline|Trained|Measured on|
|-|-|-|-|-|-|-|-|
|`graph-coloring-grpo`|Train|`nodus/grpo-lora`|Qwen/Qwen3-0.6B @ `c1899de`|64|not measured|not measured|not measured|

Run one with a server dry-run first:

Terminal window

```console
$ nodus create trainingjob my-run --from-example nodus/graph-coloring:graph-coloring-grpo --dry-run=server -o estimate
```

```python
import nodus

job = nodus.recipes.TrainingJob.from_example("nodus/graph-coloring:graph-coloring-grpo")
plan = job.preview()
run = plan.run(max_cost=5)
print(run.wait().summary)
```
