We have some input that describes the steps of a workflow. The input consists of pairs of steps, each one indicating that one step must be completed before another. For example, in sample input 1, "clean" must occur before "build" and "build" must occur before "link". The input can occur in any order.
We want to write a function to separate a given workflow's steps into multiple stages in such a way that all the steps in each individual stage can run at the same time. The function should return a list of lists. In which each list represents one stage. Each step should run in the earliest possible stage.
Sample Input 1:
precursor_steps = [
["clean", "build"],
["metadata", "binary"],
["build", "link"],
["link","binary"],
["clean", "metadata"],
["build","resources"]
]
Sample Output:
[
["clean"],
["build", "metadata"],
["resources","link"],
["binary"]
]