- java.lang.Object
-
- org.logicng.graphs.algorithms.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 Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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.static List<List<Formula>>splitFormulasByComponent(Collection<Formula> formulas, Set<Set<Node<Variable>>> components)Split a list of formulas in their respective connected components.
-
-
-
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 formulascomponents- the connected components which should be used for the split- Returns:
- the list of split formulas
-
-