I have a 2D vector of dependencies. For the first row to finish its tasks in the 2D vector it is dependent on the second row finishing its tasks. The second row is dependent on the third row to finish its tasks before it can begin. This continues on ward. The goal of the algorithm is to use threading and assign each value(task) in the row to a thread. Therefore the threads can finish one row at a time starting from the bottom.
To go a bit more in depth, task all is dependent on task a and task b to finish before it can proceed. Task a is waiting on tasks (a1,a2,a3,a4,d) to finish first before being able to finish. Task b is waiting on tasks (b1,b2,b3,e,a4) to finish before being able to finish etc. Task a and Task b are on the same row. Tasks (a1,a2,a3,a4,d) and tasks (b1,b2,b3,e,a4) are on the same row as well. I want to assign one thread to each task. I'm slightly new here so if there is anything I can do to help clarify I would be happy to do so. I would also appreciate it if there is a way to assign a thread to the next row if all the elements in the prior row are being handled by a thread and the dependencies for that task have been completed.
The amount of threads doesn't matter so we can assume there is a variable thread_count.