Module logicng

Class ConnectedComponentsComputation


  • public final class ConnectedComponentsComputation
    extends Object
    This class implements an algorithm to compute the connected components of a graph.
    Since:
    1.2
    Version:
    2.0.0
    • Method Detail

      • compute

        public static <T> Set<Set<Node<T>>> compute​(Graph<T> graph)
        Computes the set of connected components of a graph, where each component is represented by a set of nodes.
        Type Parameters:
        T - the type of the graph content
        Parameters:
        graph - the graph
        Returns:
        the set of sets of nodes representing the connected components
      • splitFormulasByComponent

        public static List<List<Formula>> splitFormulasByComponent​(Collection<Formula> formulas,
                                                                   Set<Set<Node<Variable>>> components)
        Split a list of formulas in their respective connected components. The
        Parameters:
        formulas - the list of formulas
        components - the connected components which should be used for the split
        Returns:
        the list of split formulas