Having a scenario where I need to identify task sequence and execute tasks possible indenpendent flows/tasks parallely. for example
Task 1
Task 2 ->Task 11 and task-3
Task 3 -> Task 1
Task 4 -> Task 8 and task 12
Task 5 -> Task 9
Task 7
Task 8 -> Task 10
Task 9
Task 10
Task 11
each task does some computation, all tasks will respond with a Number. need to collect all task responses in a Set () and respond to client of the method/function. independent tasks can compute parallely. Also Algorithm should find if any circular dependency.
Task 1 7,9,10 and 11 are independent
Task 2 dependent on outcome of 11 and 3
Task 3 on 1
Task 4 on 8 and 12
Task 5 on 9
what data structure and algorithm suitable for this problem, could someone help?