nicetoolbox.utils.graph.topological_sort¶
- nicetoolbox.utils.graph.topological_sort(graph: Dict[str, List[str]], missing: List[Tuple[str, str]] | None = None) List[str][source]¶
Topological sort using Kahn’s algorithm. Deterministic: alphabetical tie-breaking for nodes at the same level.
- Parameters:
graph – Mapping of node -> list of nodes it depends on.
missing – If provided, (node, dep) pairs for missing dependencies are appended here.
- Raises:
ValueError – On circular dependencies.