# Bipartite coloring check

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

Check a complete 0/1 coloring witness for graph bipartiteness and report the first certificate discrepancy.

**Use when you need to: check bipartite coloring witness · validate graph two-color certificate · verify a graph is bipartite.**

## Decide before calling

Read the [versioned contract](/v1/tools/bipartite-coloring-check/versions/1.0.0) and the supported scope below. Reuse `bipartite-coloring-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 `bipartite-coloring-check@1.0.0` for check bipartite coloring witness. 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 bipartite coloring witness
- validate graph two-color certificate
- verify a graph is bipartite
- find first invalid bipartite edge
- check zero one vertex coloring
- audit two-colorability witness

## Not supported

- finding a bipartition
- returning an odd cycle
- repairing a two-color witness

## Behavior

- colors is an index-aligned total certificate whose only admitted values are integers 0 and 1; null denotes an explicitly missing witness value.
- Edges are inspected in supplied order and must join opposite values; duplicates remain significant and a self-loop conflicts.
- A valid 0/1 coloring certifies bipartiteness; equivalently, a graph is bipartite exactly when it has no odd cycle.
- Every verdict names Diestel Graph Theory 5th ed. (2017), sections 1.6 and 5.2.
- Coverage discrepancies precede edge discrepancies; neither disconnected components nor isolated vertices receive inferred colors.

## Input

- `vertex_count` (integer, required): min 0; max 10000
- `edges` (array of object, required): max items 50000
- `colors` (array of integer or null, required): max items 10000; each min 0; each max 1

## Output

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

## Limits

- max vertices: 10000
- max edges: 50000

## Example

Request input:

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

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": "bipartite-coloring-check",
  "version": "1.0.0",
  "input": {
    "vertex_count": 4,
    "edges": [
      {
        "from": 0,
        "to": 1
      },
      {
        "from": 1,
        "to": 2
      },
      {
        "from": 2,
        "to": 3
      }
    ],
    "colors": [
      0,
      1,
      0,
      1
    ]
  }
}
```

### HTTP (no key)

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

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

### CLI

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

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

## Related tools

- [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.
- [Network flow feasibility check](/tools/network-flow-feasibility-check): Check a claimed s-t flow for capacity bounds and conservation with exact integers; returns the first bad edge or node.
- [Coloring count check](/tools/coloring-count-check): Check a proper indexed coloring and an exact canonical-decimal claim for its number of distinct colors.
- [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.
- [Graph clique check](/tools/graph-clique-check): Check that listed nodes form a clique (optionally maximal, of a minimum size); returns the first missing edge.
