scirs2_graph/
lib.rs

1#![allow(deprecated)]
2//! Graph processing module for SciRS2
3//!
4//! This module provides graph algorithms and data structures
5//! for scientific computing and machine learning applications.
6//!
7//! ## Features
8//!
9//! - Basic graph representations and operations
10//! - Graph algorithms (traversal, shortest paths, etc.)
11//! - Network analysis (centrality measures, community detection)
12//! - Spectral graph theory
13//! - Support for graph neural networks
14//!
15//! ## API Stability and Versioning
16//!
17//! scirs2-graph follows strict semantic versioning with clear stability guarantees:
18//!
19//! ### Stability Classifications
20//! - ✅ **Stable**: Core APIs guaranteed until next major version (2.0.0)
21//! - ⚠️ **Experimental**: May change in minor versions, marked with `#[cfg(feature = "experimental")]`
22//! - 📋 **Deprecated**: Will be removed in next major version, use alternatives
23//!
24//! ### Version Guarantees
25//! - **MAJOR** (1.x.x → 2.x.x): Breaking changes to stable APIs allowed
26//! - **MINOR** (1.0.x → 1.1.x): New features, deprecations only (no breaks to stable APIs)
27//! - **PATCH** (1.0.0 → 1.0.1): Bug fixes only, no API changes
28//!
29//! ### Stable Core APIs (v0.1.0-beta.1+)
30//! - Graph data structures (`Graph`, `DiGraph`, `MultiGraph`)
31//! - Basic algorithms (traversal, shortest paths, connectivity)
32//! - Graph generators and I/O operations
33//! - Community detection with `_result` suffix functions
34//! - Error handling and core types
35
36#![warn(missing_docs)]
37
38// Temporarily commenting out OpenBLAS to fix build issues
39// extern crate blas;
40// extern crate openblassrc;
41
42pub mod advanced;
43pub mod algorithms;
44pub mod attributes;
45pub mod base;
46pub mod embeddings;
47pub mod error;
48pub mod generators;
49pub mod graph_memory_profiler;
50pub mod io;
51pub mod layout;
52pub mod measures;
53pub mod memory;
54pub mod numerical_accuracy_validation;
55pub mod performance;
56pub mod spectral;
57pub mod temporal;
58pub mod weighted;
59
60// Re-export stable APIs for 1.0
61pub use algorithms::{
62    articulation_points,
63    astar_search,
64    astar_search_digraph,
65    // Centrality measures - stable for 1.0
66    betweenness_centrality,
67    bidirectional_search,
68    bidirectional_search_digraph,
69
70    // Core traversal algorithms - stable for 1.0
71    breadth_first_search,
72    breadth_first_search_digraph,
73    bridges,
74    center_nodes,
75    closeness_centrality,
76    complement,
77    // Connectivity analysis - stable for 1.0
78    connected_components,
79    cosine_similarity,
80
81    depth_first_search,
82    depth_first_search_digraph,
83    // Graph properties - stable for 1.0
84    diameter,
85    // Shortest path algorithms - stable for 1.0
86    dijkstra_path,
87    // Flow algorithms - stable for 1.0
88    dinic_max_flow,
89    edge_subgraph,
90    eigenvector_centrality,
91    eulerian_type,
92    floyd_warshall,
93    floyd_warshall_digraph,
94    fluid_communities_result,
95    greedy_coloring,
96    greedy_modularity_optimization_result,
97    hierarchical_communities_result,
98    infomap_communities,
99    is_bipartite,
100
101    // Similarity measures - stable for 1.0
102    jaccard_similarity,
103    k_core_decomposition,
104
105    k_shortest_paths,
106
107    label_propagation_result,
108    line_digraph,
109    line_graph,
110    // Community detection algorithms - stable for 1.0
111    louvain_communities_result,
112    maximal_matching,
113    // Matching algorithms - stable for 1.0
114    maximum_bipartite_matching,
115    maximum_cardinality_matching,
116    minimum_cut,
117
118    // Spanning tree algorithms - stable for 1.0
119    minimum_spanning_tree,
120
121    minimum_weight_bipartite_matching,
122    modularity,
123
124    modularity_optimization_result,
125    pagerank,
126    personalized_pagerank,
127
128    push_relabel_max_flow,
129    radius,
130    random_walk,
131    stable_marriage,
132
133    strongly_connected_components,
134    subdigraph,
135    // Graph transformations - stable for 1.0
136    subgraph,
137    tensor_product,
138    // Other algorithms - stable for 1.0
139    topological_sort,
140    transition_matrix,
141
142    weight_filtered_subgraph,
143
144    // Result types - stable for 1.0
145    AStarResult,
146    BipartiteMatching,
147    BipartiteResult,
148    CommunityResult,
149    CommunityStructure,
150    EulerianType,
151    GraphColoring,
152    InfomapResult,
153    MaximumMatching,
154    MotifType,
155};
156
157// Parallel algorithms - stable for 1.0 when parallel feature is enabled
158#[cfg(feature = "parallel")]
159pub use algorithms::{
160    parallel_label_propagation_result, parallel_louvain_communities_result, parallel_modularity,
161};
162
163// Parallel spectral operations - stable for 1.0 when parallel feature is enabled
164#[cfg(feature = "parallel")]
165pub use spectral::{parallel_laplacian, parallel_spectral_clustering};
166
167// Experimental algorithms - unstable, may change in future versions
168pub use algorithms::{
169    // Isomorphism and advanced matching - experimental
170    are_graphs_isomorphic,
171    are_graphs_isomorphic_enhanced,
172    // Complex graph products - experimental
173    cartesian_product,
174
175    // NP-hard problems - experimental (may be moved or optimized)
176    chromatic_number,
177    find_isomorphism,
178    find_isomorphism_vf2,
179    find_motifs,
180    find_subgraph_matches,
181    graph_edit_distance,
182
183    has_hamiltonian_circuit,
184    has_hamiltonian_path,
185};
186
187// Deprecated functions are commented out to eliminate warnings
188// Users should use the _result variants instead
189//
190// #[deprecated(since = "0.1.0-beta.1", note = "Use `dijkstra_path` instead")]
191// pub use algorithms::shortest_path;
192//
193// #[deprecated(since = "0.1.0-beta.1", note = "Use `louvain_communities_result` instead")]
194// pub use algorithms::louvain_communities;
195//
196// #[deprecated(since = "0.1.0-beta.1", note = "Use `label_propagation_result` instead")]
197// pub use algorithms::label_propagation;
198//
199// #[deprecated(since = "0.1.0-beta.1", note = "Use `fluid_communities_result` instead")]
200// pub use algorithms::fluid_communities;
201//
202// #[deprecated(since = "0.1.0-beta.1", note = "Use `hierarchical_communities_result` instead")]
203// pub use algorithms::hierarchical_communities;
204//
205// #[deprecated(since = "0.1.0-beta.1", note = "Use `modularity_optimization_result` instead")]
206// pub use algorithms::modularity_optimization;
207//
208// #[deprecated(since = "0.1.0-beta.1", note = "Use `greedy_modularity_optimization_result` instead")]
209// pub use algorithms::greedy_modularity_optimization;
210//
211// #[deprecated(since = "0.1.0-beta.1", note = "Use `parallel_louvain_communities_result` instead")]
212// pub use algorithms::parallel_louvain_communities;
213
214// Core graph types - stable for 1.0
215pub use base::{
216    BipartiteGraph, DiGraph, Edge, EdgeWeight, Graph, Hyperedge, Hypergraph, IndexType,
217    MultiDiGraph, MultiGraph, Node,
218};
219
220// Error handling - stable for 1.0
221pub use error::{ErrorContext, GraphError, Result};
222
223// Graph generators - stable for 1.0
224pub use generators::{
225    barabasi_albert_graph, complete_graph, cycle_graph, erdos_renyi_graph, grid_2d_graph,
226    grid_3d_graph, hexagonal_lattice_graph, path_graph, planted_partition_model, star_graph,
227    stochastic_block_model, triangular_lattice_graph, two_community_sbm, watts_strogatz_graph,
228};
229
230// Graph measures - stable for 1.0
231pub use measures::{
232    centrality, clustering_coefficient, graph_density, hits_algorithm, katz_centrality,
233    katz_centrality_digraph, pagerank_centrality, pagerank_centrality_digraph, CentralityType,
234    HitsScores,
235};
236
237// Parallel measures - stable for 1.0 when parallel feature is enabled
238#[cfg(feature = "parallel")]
239pub use measures::parallel_pagerank_centrality;
240
241// Spectral analysis - stable for 1.0
242pub use spectral::{laplacian, normalized_cut, spectral_radius};
243
244// Weighted operations - stable for 1.0
245pub use weighted::{
246    MultiWeight, NormalizationMethod, WeightStatistics, WeightTransform, WeightedOps,
247};
248
249// Attribute system - stable for 1.0
250pub use attributes::{
251    AttributeSummary, AttributeValue, AttributeView, AttributedDiGraph, AttributedGraph, Attributes,
252};
253
254// Memory optimization - stable for 1.0
255pub use memory::{
256    suggest_optimizations, BitPackedGraph, CSRGraph, CompressedAdjacencyList, FragmentationReport,
257    HybridGraph, MemoryProfiler, MemorySample, MemoryStats, OptimizationSuggestions,
258    OptimizedGraphBuilder,
259};
260
261// Performance monitoring - stable for 1.0
262pub use performance::{
263    LargeGraphIterator, LargeGraphOps, MemoryMetrics, ParallelConfig, PerformanceMonitor,
264    PerformanceReport, StreamingGraphProcessor,
265};
266
267// I/O operations - stable for 1.0
268pub use io::*;
269
270// Experimental features - subject to change
271pub use embeddings::{
272    DeepWalk, DeepWalkConfig, Embedding, EmbeddingModel, Node2Vec, Node2VecConfig, RandomWalk,
273    RandomWalkGenerator,
274};
275
276pub use layout::{circular_layout, hierarchical_layout, spectral_layout, spring_layout, Position};
277
278pub use temporal::{
279    temporal_betweenness_centrality, temporal_reachability, TemporalGraph, TemporalPath,
280    TimeInstant, TimeInterval,
281};
282
283// Advanced mode optimizations - experimental but stable API
284pub use advanced::{
285    create_advanced_processor, execute_with_advanced, AdvancedConfig, AdvancedProcessor,
286    AdvancedStats, AlgorithmMetrics, GPUAccelerationContext, NeuralRLAgent, NeuromorphicProcessor,
287};
288
289// Graph memory profiling - experimental
290pub use graph_memory_profiler::{
291    AdvancedMemoryProfiler,
292    EfficiencyAnalysis,
293    MemoryProfile,
294    MemoryProfilerConfig,
295    MemoryStats as GraphMemoryStats, // Renamed to avoid conflict
296    OptimizationOpportunity,
297    OptimizationType,
298};
299
300// Numerical accuracy validation - experimental
301pub use numerical_accuracy_validation::{
302    create_comprehensive_validation_suite, run_quick_validation, AdvancedNumericalValidator,
303    ValidationAlgorithm, ValidationConfig, ValidationReport, ValidationResult,
304    ValidationTolerances,
305};