Minimum spanning tree certificate check

minimum-spanning-tree-certificate-check · version 1.0.0 · Numbers & math · free, no key needed

Check a claimed minimum spanning tree: structure, exact weight, then the cycle/cut optimality test with a swap witness

Use when you need to: verify minimum spanning tree · check mst optimality · is this the minimum spanning tree.

Decide before calling

Read the versioned contract and the supported scope below. Reuse minimum-spanning-tree-certificate-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 minimum-spanning-tree-certificate-check@1.0.0 for verify minimum spanning tree. 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

Not supported

Behavior

Input

Output

Limits

Example

Request input:

{
  "graph": {
    "vertices": [
      "a",
      "b",
      "c",
      "d"
    ],
    "edges": [
      {
        "id": "ab",
        "u": "a",
        "v": "b",
        "weight": "1"
      },
      {
        "id": "bc",
        "u": "b",
        "v": "c",
        "weight": "2"
      },
      {
        "id": "cd",
        "u": "c",
        "v": "d",
        "weight": "3"
      },
      {
        "id": "da",
        "u": "d",
        "v": "a",
        "weight": "4"
      },
      {
        "id": "ac",
        "u": "a",
        "v": "c",
        "weight": "5"
      }
    ]
  },
  "tree_edge_ids": [
    "ab",
    "bc",
    "cd"
  ],
  "claimed_weight": "6"
}

Response:

{
  "result": {
    "valid": true,
    "reason": null,
    "first_discrepancy": null,
    "tree_weight": "6",
    "reference_version": "clrs-4e-2022-ch21-minimum-spanning-trees"
  }
}

How to call it

MCP

Connect https://computefirst.net/mcp (setup), then call execute with:

{
  "id": "minimum-spanning-tree-certificate-check",
  "version": "1.0.0",
  "input": {
    "graph": {
      "vertices": [
        "a",
        "b",
        "c",
        "d"
      ],
      "edges": [
        {
          "id": "ab",
          "u": "a",
          "v": "b",
          "weight": "1"
        },
        {
          "id": "bc",
          "u": "b",
          "v": "c",
          "weight": "2"
        },
        {
          "id": "cd",
          "u": "c",
          "v": "d",
          "weight": "3"
        },
        {
          "id": "da",
          "u": "d",
          "v": "a",
          "weight": "4"
        },
        {
          "id": "ac",
          "u": "a",
          "v": "c",
          "weight": "5"
        }
      ]
    },
    "tree_edge_ids": [
      "ab",
      "bc",
      "cd"
    ],
    "claimed_weight": "6"
  }
}

HTTP (no key)

curl -X POST https://computefirst.net/v1/tools/minimum-spanning-tree-certificate-check/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"graph":{"vertices":["a","b","c","d"],"edges":[{"id":"ab","u":"a","v":"b","weight":"1"},{"id":"bc","u":"b","v":"c","weight":"2"},{"id":"cd","u":"c","v":"d","weight":"3"},{"id":"da","u":"d","v":"a","weight":"4"},{"id":"ac","u":"a","v":"c","weight":"5"}]},"tree_edge_ids":["ab","bc","cd"],"claimed_weight":"6"}'

The machine-readable contract is at /v1/tools/minimum-spanning-tree-certificate-check/versions/1.0.0.

CLI

node cli.mjs run minimum-spanning-tree-certificate-check 1.0.0 --input input.json --base-url https://computefirst.net

Get the client at /clients/cli/.