Graph induced subgraph

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

Return the vertex-induced subgraph on a listed node subset, preserving declared node and edge order.

Use when you need to: graph induced subgraph · induced subgraph of listed nodes · restrict graph to a node subset.

Supported

Not supported

Behavior

Input

Output

Limits

Example

Request input:

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

Response:

{
  "result": {
    "nodes": [
      "compile",
      "test",
      "package"
    ],
    "edges": [
      {
        "from": "compile",
        "to": "test"
      },
      {
        "from": "test",
        "to": "package"
      }
    ]
  }
}

How to call it

MCP

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

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

HTTP (no key)

curl -X POST https://computefirst.net/v1/tools/graph-induced-subgraph/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":"lint"},{"from":"test","to":"package"},{"from":"lint","to":"package"},{"from":"package","to":"deploy"}],"keep":["package","compile","test"]}'

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

CLI

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

Get the client at /clients/cli/.