Class GraphCycleDetector
- java.lang.Object
-
- fr.gouv.vitam.worker.core.plugin.reclassification.utils.GraphCycleDetector
-
public class GraphCycleDetector extends java.lang.Object
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 Constructor Description GraphCycleDetector()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addRelations(java.lang.String child, java.util.Collection<java.lang.String> parents)
Add child/parent relations to the graphjava.util.Set<java.lang.String>
checkCycles()
Check cycles among the graph.void
removeRelations(java.lang.String child, java.util.Collection<java.lang.String> parents)
Remove child/parent relations from the graph
-
-
-
Method Detail
-
addRelations
public void addRelations(java.lang.String child, java.util.Collection<java.lang.String> parents)
Add child/parent relations to the graph- Parameters:
child
- the child unit idparents
- the list of parent unit ids
-
removeRelations
public void removeRelations(java.lang.String child, java.util.Collection<java.lang.String> parents)
Remove child/parent relations from the graph- Parameters:
child
- the child unit idparents
- the list of parent unit ids
-
checkCycles
public java.util.Set<java.lang.String> 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.
-
-