1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//! Clustering algorithms for behavioral method grouping.
//!
//! This module provides various clustering strategies for grouping methods
//! based on their behavioral characteristics and call patterns:
//!
//! - **Call graph analysis**: Builds adjacency matrix from method calls
//! - **Community detection**: Groups methods by call graph connectivity
//! - **Hybrid clustering**: Combines name-based categorization with call graph analysis
//! - **Production-ready clustering**: Comprehensive pipeline with test filtering and size balancing
//!
//! # Module Structure
//!
//! ```text
//! clustering/
//! ├── mod.rs # Public API (this file)
//! ├── call_graph.rs # Build method call adjacency matrix
//! ├── cohesion.rs # Cohesion calculation utilities
//! ├── community.rs # Community detection algorithm
//! ├── hybrid.rs # Hybrid name + call-graph clustering
//! ├── pipeline.rs # Production pipeline with warnings
//! └── refinement.rs # Cluster refinement and patterns
//! ```
//!
//! # Design Principles
//!
//! 1. **Pure Functions**: All clustering algorithms are pure
//! 2. **Warnings as Data**: No logging in core; return `ClusteringResult`
//! 3. **Single Responsibility**: Each module handles one aspect
//! 4. **Composable Pipeline**: Production clustering is composed of steps
//!
//! # Usage
//!
//! ```rust,ignore
//! use debtmap::organization::behavioral_decomposition::clustering;
//!
//! // Build call graph
//! let adjacency = clustering::build_method_call_adjacency_matrix(&impl_blocks);
//!
//! // Apply clustering
//! let result = clustering::apply_production_ready_clustering(&methods, &adjacency);
//!
//! // Handle warnings at I/O boundary
//! for warning in &result.warnings {
//! eprintln!("Warning: {:?}", warning);
//! }
//!
//! // Use clusters
//! for cluster in result.clusters {
//! println!("Cluster {}: {} methods",
//! cluster.category.display_name(),
//! cluster.methods.len()
//! );
//! }
//! ```
// Re-export call graph functions
pub use ;
// Re-export community detection
pub use apply_community_detection;
// Re-export hybrid clustering
pub use apply_hybrid_clustering;
// Re-export production pipeline
pub use ;