I introduced JGraphT library to my project and I'm constructing a directed graph of some resources to create with their dependencies. I'm going to use topological sort to determine an order of creation to pass it to other component. I'd like to determine resources that could be created in parallel as they don't have dependencies (direct or indirect) to each other (I'm interpreting it as resources having equal priorities of creation). TopologicalOrderIterator just returns vertices in order but doesn't seem to handle a case of equal priorities.
For example, for graph as below:
The valid orders are A, B, D, C or for example A, D, B, C or even D, A, B, C. I'd like to determine the fact, that resources D and A or D and B can be created in parallel and have something like {D, A}, B, C.
Is it possible to achieve it with JGraphT using topological sort or any other mechanism? Or if not, then maybe some recommendation of other graph library?