# Coloring count check

`coloring-count-check` · version 1.0.0 · Numbers & math · free, no key needed

Check a proper indexed coloring and an exact canonical-decimal claim for its number of distinct colors.

**Use when you need to: check claimed coloring count · validate number of colors used · verify coloring and distinct color total.**

## Decide before calling

Read the [versioned contract](/v1/tools/coloring-count-check/versions/1.0.0) and the supported scope below. Reuse `coloring-count-check@1.0.0` when your input, required output and limits match it. Choose another approach for an unsupported operation.

## Explain the choice

"I can use `coloring-count-check@1.0.0` for check claimed coloring count. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."

## Supported

- check claimed coloring count
- validate number of colors used
- verify coloring and distinct color total
- check exact graph color count claim
- audit a coloring count certificate
- compare claimed count with used colors

## Not supported

- computing the chromatic number
- finding a smaller coloring
- renaming or repairing colors

## Behavior

- The supplied assignment must first be a proper total coloring under the same indexed-graph rules as coloring-validity-check.
- claimed_count uses canonical ASCII decimal grammar 0 or [1-9][0-9]*; arithmetic is exact because its bounded value is converted only after grammar checking.
- Distinct colors are exact string values, counted by a prototype-safe Set; null is not a color.
- Every verdict names Diestel Graph Theory 5th ed. (2017), sections 1.6 and 5.2.
- Discrepancies are ordered by vertex coverage, then supplied edge index, then the count comparison.

## Input

- `vertex_count` (integer, required): min 0; max 10000
- `edges` (array of object, required): max items 50000
- `colors` (array of string or null, required): max items 10000; each max length 64
- `claimed_count` (string, required): max length 5; pattern `^(0|[1-9][0-9]*)$`

## Output

- `valid` (boolean, required)
- `reason` (string, optional)
- `discrepancy` (object, optional)
- `reference_version` (string, required)

## Limits

- max vertices: 10000
- max edges: 50000
- max color bytes: 64

## Example

Request input:

```json
{
  "vertex_count": 4,
  "edges": [
    {
      "from": 0,
      "to": 1
    },
    {
      "from": 2,
      "to": 3
    }
  ],
  "colors": [
    "a",
    "b",
    "a",
    "b"
  ],
  "claimed_count": "2"
}
```

Response:

```json
{
  "result": {
    "valid": true,
    "reference_version": "Diestel Graph Theory 5th ed. (2017), sections 1.6 and 5.2"
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "coloring-count-check",
  "version": "1.0.0",
  "input": {
    "vertex_count": 4,
    "edges": [
      {
        "from": 0,
        "to": 1
      },
      {
        "from": 2,
        "to": 3
      }
    ],
    "colors": [
      "a",
      "b",
      "a",
      "b"
    ],
    "claimed_count": "2"
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/coloring-count-check/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"vertex_count":4,"edges":[{"from":0,"to":1},{"from":2,"to":3}],"colors":["a","b","a","b"],"claimed_count":"2"}'
```

The machine-readable contract is at [/v1/tools/coloring-count-check/versions/1.0.0](/v1/tools/coloring-count-check/versions/1.0.0).

### CLI

```sh
node cli.mjs run coloring-count-check 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [Chromatic certificate check](/tools/chromatic-certificate-check): Check a claim chi(G) = k: a proper k-colouring plus a clique or bounded exhaustive proof; returns the first discrepancy.
- [Bipartite coloring check](/tools/bipartite-coloring-check): Check a complete 0/1 coloring witness for graph bipartiteness and report the first certificate discrepancy.
- [Coloring validity check](/tools/coloring-validity-check): Check an indexed graph coloring certificate and report the first uncovered vertex or monochromatic edge.
- [Graph coloring check](/tools/graph-coloring-check): Check that a node colouring of an undirected graph is proper (and within k colours); returns the first conflict.
- [Linear residual check](/tools/linear-residual-check): Check a claimed residual r = b - A x (per component and/or its max norm) exactly for an approximate solution x.
- [Lp optimality certificate check](/tools/lp-optimality-certificate-check): Check an LP optimum claim from a primal x and dual y: feasibility, complementary slackness and zero duality gap.
