Class KruskalClusterer
java.lang.Object
com.graphhopper.jsprit.core.algorithm.ruin.KruskalClusterer
Clusters jobs in a route using Kruskal's Minimum Spanning Tree algorithm.
Algorithm: 1. Build complete distance graph between all jobs in route 2. Run Kruskal's algorithm to build MST 3. Remove longest edge in MST 4. Result: exactly 2 clusters (connected components)
Ranked #2 in Voigt (2025) "A review and ranking of operators in adaptive large neighborhood search for vehicle routing problems."
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetClusters(VehicleRoute route) Returns two clusters from the route by cutting the longest MST edge.getOneCluster(VehicleRoute route, boolean preferSmaller) Returns one cluster (randomly chosen or smaller) from the route.void
-
Constructor Details
-
KruskalClusterer
-
-
Method Details
-
setRandom
-
getClusters
Returns two clusters from the route by cutting the longest MST edge.- Parameters:
route- the route to cluster- Returns:
- list containing exactly 2 clusters, or empty list if route has invalid input: '<' 2 jobs
-
getOneCluster
Returns one cluster (randomly chosen or smaller) from the route.- Parameters:
route- the route to clusterpreferSmaller- if true, returns smaller cluster; if false, random- Returns:
- one cluster of jobs
-