Directional graph processing in Java

I look forward to implementing a Java application that will compute a set of tasks to perform Tasks will depend on each other to form a directed graph Is there an existing SDK or algorithm (preferably Java) that can help me:

>Define task graph > make sure there are no cyclic dependencies in the graph > use thread pool to execute tasks in the graph

Step 3 is the most important part I need to execute tasks in parallel for maximum performance, while ensuring that tasks are not executed before dependencies

Solution

Take a look at the previous question, which mainly recommends the use of jgrapht

It will obviously become simple and have a loop detector in part 3 Don't think it will do part 3 for you, but all you need to do is get the degrees of all vertices (or degrees depending on your representation) to 0 and start these tasks When the task is complete, delete the vertices from the graph and start again

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>