Spanning tree structure check

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

Check that claimed edge IDs form a spanning tree of a graph; reports the first missing, repeated or cyclic edge

Use when you need to: check spanning tree claim · is this edge set a spanning tree · verify tree spans all vertices.

Decide before calling

Read the versioned contract and the supported scope below. Reuse spanning-tree-structure-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 spanning-tree-structure-check@1.0.0 for check spanning tree claim. 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"
      }
    ]
  },
  "tree_edge_ids": [
    "ab",
    "bc",
    "cd"
  ]
}

Response:

{
  "result": {
    "valid": true,
    "reason": null,
    "first_discrepancy": null,
    "tree_edge_count": 3,
    "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": "spanning-tree-structure-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"
        }
      ]
    },
    "tree_edge_ids": [
      "ab",
      "bc",
      "cd"
    ]
  }
}

HTTP (no key)

curl -X POST https://computefirst.net/v1/tools/spanning-tree-structure-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"}]},"tree_edge_ids":["ab","bc","cd"]}'

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

CLI

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

Get the client at /clients/cli/.