Class GraphCycleDetector
java.lang.Object
fr.gouv.vitam.worker.core.plugin.reclassification.utils.GraphCycleDetector
Helper class for graph cycle detection.
Usage :
- addRelations() + removeRelations() to create target graph.
- checkCycles() to get cycles in the graph, if any.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addRelations
(String child, Collection<String> parents) Add child/parent relations to the graphCheck cycles among the graph.void
removeRelations
(String child, Collection<String> parents) Remove child/parent relations from the graph
-
Constructor Details
-
GraphCycleDetector
public GraphCycleDetector()
-
-
Method Details
-
addRelations
Add child/parent relations to the graph- Parameters:
child
- the child unit idparents
- the list of parent unit ids
-
removeRelations
Remove child/parent relations from the graph- Parameters:
child
- the child unit idparents
- the list of parent unit ids
-
checkCycles
Check cycles among the graph.- Returns:
- a set of unit ids having one or more cycles is any. An empty set is returned if no cycles are detected.
-