java.lang.Object
fr.gouv.vitam.worker.core.plugin.reclassification.utils.GraphCycleDetector

public class GraphCycleDetector extends Object
Helper class for graph cycle detection. Usage : - addRelations() + removeRelations() to create target graph. - checkCycles() to get cycles in the graph, if any.
  • Constructor Details

    • GraphCycleDetector

      public GraphCycleDetector()
  • Method Details

    • addRelations

      public void addRelations(String child, Collection<String> parents)
      Add child/parent relations to the graph
      Parameters:
      child - the child unit id
      parents - the list of parent unit ids
    • removeRelations

      public void removeRelations(String child, Collection<String> parents)
      Remove child/parent relations from the graph
      Parameters:
      child - the child unit id
      parents - the list of parent unit ids
    • checkCycles

      public Set<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.