java.lang.Object
org.jgrapht.alg.clustering.KSpanningTreeClustering<V,E>
- Type Parameters:
V
- the graph vertex typeE
- the graph edge type
- All Implemented Interfaces:
ClusteringAlgorithm<V>
The k spanning tree clustering algorithm.
The algorithm finds a minimum spanning tree $T$ using Prim's algorithm, then executes Kruskal's algorithm only on the edges of $T$ until $k$ trees are formed. The resulting trees are the final clusters. The total running time is $O(m + n \log n)$.
The algorithm is strongly related to single linkage cluster analysis, also known as single-link clustering. For more information see: J. C. Gower and G. J. S. Ross. Minimum Spanning Trees and Single Linkage Cluster Analysis. Journal of the Royal Statistical Society. Series C (Applied Statistics), 18(1):54--64, 1969.
- Author:
- Dimitrios Michail
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.jgrapht.alg.interfaces.ClusteringAlgorithm
ClusteringAlgorithm.Clustering<V>, ClusteringAlgorithm.ClusteringImpl<V>
-
Constructor Summary
ConstructorDescriptionKSpanningTreeClustering
(Graph<V, E> graph, int k) Create a new clustering algorithm. -
Method Summary
Modifier and TypeMethodDescriptionComputes a clustering.
-
Constructor Details
-
KSpanningTreeClustering
Create a new clustering algorithm.- Parameters:
graph
- the graph (needs to be undirected)k
- the desired number of clusters
-
-
Method Details
-
getClustering
Description copied from interface:ClusteringAlgorithm
Computes a clustering.- Specified by:
getClustering
in interfaceClusteringAlgorithm<V>
- Returns:
- a clustering
-