@@ -227,6 +227,32 @@ void build_linkage(
227227 raft::device_vector_view<float , int64_t > out_distances,
228228 raft::device_vector_view<int64_t , int64_t > out_sizes,
229229 std::optional<raft::device_vector_view<float , int64_t >> core_dists);
230+
231+ /* *
232+ * Build dendrogram from a Minimum Spanning Tree (MST).
233+ *
234+ * This function takes a sorted MST (represented as edges with source, destination, and weights)
235+ * and constructs a dendrogram (hierarchical clustering tree) on the host.
236+ *
237+ * @param[in] handle The raft resources handle
238+ * @param[in] rows Source nodes of the MST edges (device memory, size: nnz)
239+ * @param[in] cols Destination nodes of the MST edges (device memory, size: nnz)
240+ * @param[in] data Edge weights/distances of the MST (device memory, size: nnz)
241+ * @param[out] children Output dendrogram children array (device memory, size: nnz * 2)
242+ * Each pair of consecutive elements represents the two children
243+ * merged at each step of the hierarchy
244+ * @param[out] out_delta Output distances/heights at which clusters are merged (device memory, size:
245+ * nnz)
246+ * @param[out] out_size Output cluster sizes at each merge step (device memory, size: nnz)
247+ */
248+ void build_dendrogram (raft::resources const & handle,
249+ raft::device_vector_view<const int64_t , int64_t > rows,
250+ raft::device_vector_view<const int64_t , int64_t > cols,
251+ raft::device_vector_view<const float , int64_t > data,
252+ raft::device_matrix_view<int64_t , int64_t , raft::row_major> children,
253+ raft::device_vector_view<float , int64_t > out_delta,
254+ raft::device_vector_view<int64_t , int64_t > out_size);
255+
230256} // namespace helpers
231257/* *
232258 * @}
0 commit comments