Package fr.gouv.vitam.worker.core.plugin.reclassification.utils

# Class GraphCycleDetector

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 Summary

  Constructors
  Constructor
  Description
  `GraphCycleDetector()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `addRelations(String child, Collection<String> parents)`
  Add child/parent relations to the graph
  `Set<String>`
  `checkCycles()`
  Check cycles among the graph.
  `void`
  `removeRelations(String child, Collection<String> parents)`
  Remove child/parent relations from the graph

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## 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.