java.lang.Object
org.jhotdraw8.graph.algo.DisjointSetsAlgo
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfindDisjointSets(@NonNull Collection<V> vertices, @NonNull Function<V, Iterable<V>> getNextVertices) Given a directed graph, returns all disjoint sets of vertices.findDisjointSets(@NonNull DirectedGraph<V, A> graph) Given a directed graph, returns all disjoint sets of vertices.
-
Constructor Details
-
DisjointSetsAlgo
public DisjointSetsAlgo()
-
-
Method Details
-
findDisjointSets
Given a directed graph, returns all disjoint sets of vertices.Uses Kruskal's algorithm.
- Type Parameters:
V- the vertex data typeA- the arrow data type- Parameters:
graph- a directed graph- Returns:
- the disjoint sets.
-
findDisjointSets
public <V> @NonNull List<Set<V>> findDisjointSets(@NonNull Collection<V> vertices, @NonNull Function<V, Iterable<V>> getNextVertices) Given a directed graph, returns all disjoint sets of vertices.Uses Kruskal's algorithm.
- Type Parameters:
V- the vertex data type- Parameters:
vertices- the vertices of the directed graphgetNextVertices- a function that returns the next vertices given a vertex- Returns:
- the disjoint sets.
-