Graph DAG longest path

graph-dag-longest-path · version 1.0.0 · Graphs & scheduling · free, no key needed

Return a longest node-weighted path in a DAG, where path weight is the sum of node durations.

Use when you need to: graph dag longest path · longest node-weighted path in a dag · dag longest duration chain.

Supported

Not supported

Behavior

Input

Output

Limits

Example

Request input:

{
  "nodes": [
    "design",
    "build",
    "test",
    "ship"
  ],
  "edges": [
    {
      "from": "design",
      "to": "build"
    },
    {
      "from": "build",
      "to": "test"
    },
    {
      "from": "design",
      "to": "test"
    },
    {
      "from": "test",
      "to": "ship"
    }
  ],
  "durations": {
    "design": "3",
    "build": "5",
    "test": "2",
    "ship": "1"
  }
}

Response:

{
  "result": {
    "path": [
      "design",
      "build",
      "test",
      "ship"
    ],
    "length": "11"
  }
}

How to call it

MCP

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

{
  "id": "graph-dag-longest-path",
  "version": "1.0.0",
  "input": {
    "nodes": [
      "design",
      "build",
      "test",
      "ship"
    ],
    "edges": [
      {
        "from": "design",
        "to": "build"
      },
      {
        "from": "build",
        "to": "test"
      },
      {
        "from": "design",
        "to": "test"
      },
      {
        "from": "test",
        "to": "ship"
      }
    ],
    "durations": {
      "design": "3",
      "build": "5",
      "test": "2",
      "ship": "1"
    }
  }
}

HTTP (no key)

curl -X POST https://computefirst.net/v1/tools/graph-dag-longest-path/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"nodes":["design","build","test","ship"],"edges":[{"from":"design","to":"build"},{"from":"build","to":"test"},{"from":"design","to":"test"},{"from":"test","to":"ship"}],"durations":{"design":"3","build":"5","test":"2","ship":"1"}}'

The machine-readable contract is at /v1/tools/graph-dag-longest-path/versions/1.0.0.

CLI

node cli.mjs run graph-dag-longest-path 1.0.0 --input input.json --base-url https://computefirst.net

Get the client at /clients/cli/.