Shortest path certificate check

shortest-path-certificate-check · version 1.0.0 · Numbers & math · free, no key needed

Check a claimed shortest s-t path and distance in a weighted digraph using a caller-supplied potential certificate.

Use when you need to: verify shortest path certificate · prove path is shortest with potentials · check claimed shortest path and distance.

Decide before calling

Read the versioned contract and the supported scope below. Reuse shortest-path-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 shortest-path-certificate-check@1.0.0 for verify shortest path certificate. 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": [
      "s",
      "t",
      "x",
      "y",
      "z"
    ],
    "edges": [
      {
        "id": "st",
        "from": "s",
        "to": "t",
        "weight": "10"
      },
      {
        "id": "sy",
        "from": "s",
        "to": "y",
        "weight": "5"
      },
      {
        "id": "tx",
        "from": "t",
        "to": "x",
        "weight": "1"
      },
      {
        "id": "ty",
        "from": "t",
        "to": "y",
        "weight": "2"
      },
      {
        "id": "yt",
        "from": "y",
        "to": "t",
        "weight": "3"
      },
      {
        "id": "yx",
        "from": "y",
        "to": "x",
        "weight": "9"
      },
      {
        "id": "yz",
        "from": "y",
        "to": "z",
        "weight": "2"
      },
      {
        "id": "xz",
        "from": "x",
        "to": "z",
        "weight": "4"
      },
      {
        "id": "zs",
        "from": "z",
        "to": "s",
        "weight": "7"
      },
      {
        "id": "zx",
        "from": "z",
        "to": "x",
        "weight": "6"
      }
    ]
  },
  "source": "s",
  "target": "x",
  "path_edge_ids": [
    "sy",
    "yt",
    "tx"
  ],
  "claimed_distance": "9",
  "potentials": [
    {
      "vertex": "s",
      "potential": "0"
    },
    {
      "vertex": "t",
      "potential": "8"
    },
    {
      "vertex": "x",
      "potential": "9"
    },
    {
      "vertex": "y",
      "potential": "5"
    },
    {
      "vertex": "z",
      "potential": "7"
    }
  ]
}

Response:

{
  "result": {
    "valid": true,
    "reason": null,
    "first_discrepancy": null,
    "path_weight": "9",
    "reference_version": "clrs-4e-2022-ch22-single-source-shortest-paths"
  }
}

How to call it

MCP

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

{
  "id": "shortest-path-certificate-check",
  "version": "1.0.0",
  "input": {
    "graph": {
      "vertices": [
        "s",
        "t",
        "x",
        "y",
        "z"
      ],
      "edges": [
        {
          "id": "st",
          "from": "s",
          "to": "t",
          "weight": "10"
        },
        {
          "id": "sy",
          "from": "s",
          "to": "y",
          "weight": "5"
        },
        {
          "id": "tx",
          "from": "t",
          "to": "x",
          "weight": "1"
        },
        {
          "id": "ty",
          "from": "t",
          "to": "y",
          "weight": "2"
        },
        {
          "id": "yt",
          "from": "y",
          "to": "t",
          "weight": "3"
        },
        {
          "id": "yx",
          "from": "y",
          "to": "x",
          "weight": "9"
        },
        {
          "id": "yz",
          "from": "y",
          "to": "z",
          "weight": "2"
        },
        {
          "id": "xz",
          "from": "x",
          "to": "z",
          "weight": "4"
        },
        {
          "id": "zs",
          "from": "z",
          "to": "s",
          "weight": "7"
        },
        {
          "id": "zx",
          "from": "z",
          "to": "x",
          "weight": "6"
        }
      ]
    },
    "source": "s",
    "target": "x",
    "path_edge_ids": [
      "sy",
      "yt",
      "tx"
    ],
    "claimed_distance": "9",
    "potentials": [
      {
        "vertex": "s",
        "potential": "0"
      },
      {
        "vertex": "t",
        "potential": "8"
      },
      {
        "vertex": "x",
        "potential": "9"
      },
      {
        "vertex": "y",
        "potential": "5"
      },
      {
        "vertex": "z",
        "potential": "7"
      }
    ]
  }
}

HTTP (no key)

curl -X POST https://computefirst.net/v1/tools/shortest-path-certificate-check/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"graph":{"vertices":["s","t","x","y","z"],"edges":[{"id":"st","from":"s","to":"t","weight":"10"},{"id":"sy","from":"s","to":"y","weight":"5"},{"id":"tx","from":"t","to":"x","weight":"1"},{"id":"ty","from":"t","to":"y","weight":"2"},{"id":"yt","from":"y","to":"t","weight":"3"},{"id":"yx","from":"y","to":"x","weight":"9"},{"id":"yz","from":"y","to":"z","weight":"2"},{"id":"xz","from":"x","to":"z","weight":"4"},{"id":"zs","from":"z","to":"s","weight":"7"},{"id":"zx","from":"z","to":"x","weight":"6"}]},"source":"s","target":"x","path_edge_ids":["sy","yt","tx"],"claimed_distance":"9","potentials":[{"vertex":"s","potential":"0"},{"vertex":"t","potential":"8"},{"vertex":"x","potential":"9"},{"vertex":"y","potential":"5"},{"vertex":"z","potential":"7"}]}'

The machine-readable contract is at /v1/tools/shortest-path-certificate-check/versions/1.0.0.

CLI

node cli.mjs run shortest-path-certificate-check 1.0.0 --input input.json --base-url https://computefirst.net

Get the client at /clients/cli/.