Topological Sort Engine

Topological Sort Engine MCP Connector for Claude

A+

Perform topological sorting on DAGs using Kahn's and DFS algorithms to resolve dependencies and detect cycles.

3 tools Official Updated Oct 1, 2026 Official Vinkius Partner

The Topological Sort Engine provides specialized tools for managing directed acyclic graphs (DAGs). By utilizing calculate_kahn_sort, you can generate a linear execution order based on in-degree reduction. For alternative traversal methods, calculate_dfs_sort uses depth-first search to reconstruct task sequences. If your graph contains circular dependencies that prevent sorting, use identify_cycles to pinpoint the exact nodes involved in the loops. This engine is ideal for task scheduling, build system orchestration, and resolving complex prerequisite chains.

dagtopological-sortkahn-algorithmdfscycle-detectiondependency-resolution

3 tools expose this connector's capabilities to your AI agent.

calculate_dfs_sort

Generate a valid execution order using DFS-based approach

calculate_kahn_sort

Generate a valid linear execution order using Kahn's Algorithm

identify_cycles

Isolate and list all nodes that are part of circular dependencies

See how to talk to your AI agent using Topological Sort Engine.

Using `calculate_kahn_sort`, what is the execution order for nodes ['A', 'B', 'C'] with edges [['A', 'B'], ['B', 'C']]?

The valid execution order is: A, B, C.

I have a dependency loop between Task 1 and Task 2. Which tool should I use to find the nodes?

You should use the `identify_cycles` tool to list all nodes involved in the circular dependency.

Check if this dependency chain is valid: nodes ['Task1', 'Task2'], edges [['Task1', 'Task2'], ['Task2', 'Task1']]

The graph contains a cycle involving Task1 and Task2, so a topological sort is not possible.

Kahn's algorithm uses an in-degree reduction approach (BFS), while the DFS-based method explores paths deeply before backtracking to reconstruct the sequence.

Related Connectors