Catalog/workflow-detect-cycle

Workflow

Graph cycle detection API

Detects whether a directed graph contains a cycle and returns one concrete example cycle path if present, using DFS colouring. Answers 'Does this dependency graph have a cycle?', 'Which nodes form the loop?'.

Price$0.02per request
MethodPOST
Route/v1/workflow/detect-cycle
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
cycledetectiongraphdagloopdependenciesdfsworkflow
API URLhttps://x402.hexl.dev/v1/workflow/detect-cycle
Integration docs
Example request
{
  "nodes": [
    "a",
    "b",
    "c"
  ],
  "edges": [
    [
      "a",
      "b"
    ],
    [
      "b",
      "c"
    ],
    [
      "c",
      "a"
    ]
  ]
}
Example response
{
  "hasCycle": true,
  "cycle": [
    "a",
    "b",
    "c",
    "a"
  ],
  "interpretation": "Cycle found: a -> b -> c -> a."
}
Input schema
{
  "type": "object",
  "required": [
    "nodes",
    "edges"
  ],
  "properties": {
    "nodes": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "examples": [
        [
          "a",
          "b",
          "c"
        ]
      ]
    },
    "edges": {
      "type": "array",
      "examples": [
        [
          [
            "a",
            "b"
          ],
          [
            "b",
            "c"
          ],
          [
            "c",
            "a"
          ]
        ]
      ]
    }
  }
}
Output schema
{
  "type": "object",
  "additionalProperties": true
}