Graph ancestors

graph-ancestors · version 1.0.0 · Graphs & scheduling · free, no key needed

List every ancestor of given targets, including the targets, in reverse-graph BFS discovery order.

Use when you need to: graph ancestors · upstream prerequisites of targets · ancestors of graph nodes.

Supported

Not supported

Behavior

Input

Output

Limits

Example

Request input:

{
  "nodes": [
    "compile",
    "test",
    "lint",
    "package",
    "deploy"
  ],
  "edges": [
    {
      "from": "compile",
      "to": "test"
    },
    {
      "from": "compile",
      "to": "package"
    },
    {
      "from": "lint",
      "to": "package"
    },
    {
      "from": "test",
      "to": "deploy"
    },
    {
      "from": "package",
      "to": "deploy"
    }
  ],
  "targets": [
    "deploy"
  ]
}

Response:

{
  "result": {
    "nodes": [
      "deploy",
      "test",
      "package",
      "compile",
      "lint"
    ]
  }
}

How to call it

MCP

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

{
  "id": "graph-ancestors",
  "version": "1.0.0",
  "input": {
    "nodes": [
      "compile",
      "test",
      "lint",
      "package",
      "deploy"
    ],
    "edges": [
      {
        "from": "compile",
        "to": "test"
      },
      {
        "from": "compile",
        "to": "package"
      },
      {
        "from": "lint",
        "to": "package"
      },
      {
        "from": "test",
        "to": "deploy"
      },
      {
        "from": "package",
        "to": "deploy"
      }
    ],
    "targets": [
      "deploy"
    ]
  }
}

HTTP (no key)

curl -X POST https://computefirst.net/v1/tools/graph-ancestors/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"nodes":["compile","test","lint","package","deploy"],"edges":[{"from":"compile","to":"test"},{"from":"compile","to":"package"},{"from":"lint","to":"package"},{"from":"test","to":"deploy"},{"from":"package","to":"deploy"}],"targets":["deploy"]}'

The machine-readable contract is at /v1/tools/graph-ancestors/versions/1.0.0.

CLI

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

Get the client at /clients/cli/.