Use BuildAndSort.
Build dependency graph and sort topologically
Use DetectCycles.
Detect cycles in the dependency graph
Deprecated
Use BuildAndSort.