Crate scirs2_graph

Crate scirs2_graph 

Source
Expand description

ยงSciRS2 Graph - Graph Algorithms and Network Analysis

scirs2-graph provides comprehensive graph algorithms and data structures for network analysis, offering shortest paths, centrality measures, community detection, spectral methods, and graph embeddings with parallel processing and memory-efficient implementations.

ยง๐ŸŽฏ Key Features

  • Graph Representations: Directed, undirected, weighted, multi-graphs
  • Classic Algorithms: BFS, DFS, Dijkstra, A*, Bellman-Ford, Floyd-Warshall
  • Centrality Measures: Betweenness, closeness, eigenvector, PageRank
  • Community Detection: Louvain, label propagation, spectral clustering
  • Spectral Methods: Graph Laplacian, spectral clustering, graph embeddings
  • Network Metrics: Clustering coefficient, diameter, average path length
  • Performance: Parallel algorithms, memory profiling

ยง๐Ÿ“ฆ Module Overview

SciRS2 ModuleNetworkX/igraph EquivalentDescription
algorithmsnetworkx.algorithmsCore graph algorithms (BFS, DFS, shortest paths)
measuresnetworkx.centralityCentrality and network metrics
spectralscipy.sparse.linalgSpectral graph theory and embeddings
generatorsnetworkx.generatorsGraph generation (random, regular, etc.)
ionetworkx.readwriteGraph I/O (GML, GraphML, edge lists)

ยง๐Ÿš€ Quick Start

[dependencies]
scirs2-graph = "0.1.0-rc.2"
use scirs2_graph::{Graph, breadth_first_search, betweenness_centrality};

// Create graph and run BFS
let mut g: Graph<i32, f64> = Graph::new();
let n0 = g.add_node(0);
let n1 = g.add_node(1);
g.add_edge(0, 1, 1.0);

ยง๐Ÿ”’ Version: 0.1.0-rc.2 (October 03, 2025)

ยงAPI Stability and Versioning

scirs2-graph follows strict semantic versioning with clear stability guarantees:

ยงStability Classifications

  • โœ… Stable: Core APIs guaranteed until next major version (2.0.0)
  • โš ๏ธ Experimental: May change in minor versions, marked with #[cfg(feature = "experimental")]
  • ๐Ÿ“‹ Deprecated: Will be removed in next major version, use alternatives

ยงVersion Guarantees

  • MAJOR (1.x.x โ†’ 2.x.x): Breaking changes to stable APIs allowed
  • MINOR (1.0.x โ†’ 1.1.x): New features, deprecations only (no breaks to stable APIs)
  • PATCH (1.0.0 โ†’ 1.0.1): Bug fixes only, no API changes

ยงStable Core APIs (v0.1.0-beta.1+)

  • Graph data structures (Graph, DiGraph, MultiGraph)
  • Basic algorithms (traversal, shortest paths, connectivity)
  • Graph generators and I/O operations
  • Community detection with _result suffix functions
  • Error handling and core types

Re-exportsยง

pub use algorithms::articulation_points;
pub use algorithms::astar_search_digraph;
pub use algorithms::betweenness_centrality;
pub use algorithms::bidirectional_search_digraph;
pub use algorithms::breadth_first_search_digraph;
pub use algorithms::bridges;
pub use algorithms::center_nodes;
pub use algorithms::closeness_centrality;
pub use algorithms::complement;
pub use algorithms::connected_components;
pub use algorithms::cosine_similarity;
pub use algorithms::depth_first_search_digraph;
pub use algorithms::diameter;
pub use algorithms::dijkstra_path;
pub use algorithms::dinic_max_flow;
pub use algorithms::edge_subgraph;
pub use algorithms::eigenvector_centrality;
pub use algorithms::eulerian_type;
pub use algorithms::floyd_warshall;
pub use algorithms::floyd_warshall_digraph;
pub use algorithms::fluid_communities_result;
pub use algorithms::greedy_coloring;
pub use algorithms::greedy_modularity_optimization_result;
pub use algorithms::hierarchical_communities_result;
pub use algorithms::infomap_communities;
pub use algorithms::is_bipartite;
pub use algorithms::jaccard_similarity;
pub use algorithms::k_core_decomposition;
pub use algorithms::k_shortest_paths;
pub use algorithms::label_propagation_result;
pub use algorithms::line_digraph;
pub use algorithms::line_graph;
pub use algorithms::louvain_communities_result;
pub use algorithms::maximal_matching;
pub use algorithms::maximum_bipartite_matching;
pub use algorithms::maximum_cardinality_matching;
pub use algorithms::minimum_cut;
pub use algorithms::minimum_spanning_tree;
pub use algorithms::minimum_weight_bipartite_matching;
pub use algorithms::modularity;
pub use algorithms::modularity;
pub use algorithms::modularity_optimization_result;
pub use algorithms::pagerank;
pub use algorithms::personalized_pagerank;
pub use algorithms::push_relabel_max_flow;
pub use algorithms::radius;
pub use algorithms::random_walk;
pub use algorithms::random_walk;
pub use algorithms::stable_marriage;
pub use algorithms::strongly_connected_components;
pub use algorithms::subdigraph;
pub use algorithms::subgraph;
pub use algorithms::tensor_product;
pub use algorithms::topological_sort;
pub use algorithms::transition_matrix;
pub use algorithms::weight_filtered_subgraph;
pub use algorithms::AStarResult;
pub use algorithms::BipartiteMatching;
pub use algorithms::BipartiteResult;
pub use algorithms::CommunityResult;
pub use algorithms::CommunityStructure;
pub use algorithms::EulerianType;
pub use algorithms::GraphColoring;
pub use algorithms::InfomapResult;
pub use algorithms::MaximumMatching;
pub use algorithms::MotifType;
pub use algorithms::are_graphs_isomorphic;
pub use algorithms::are_graphs_isomorphic_enhanced;
pub use algorithms::cartesian_product;
pub use algorithms::chromatic_number;
pub use algorithms::find_isomorphism;
pub use algorithms::find_isomorphism_vf2;
pub use algorithms::find_motifs;
pub use algorithms::find_subgraph_matches;
pub use algorithms::graph_edit_distance;
pub use algorithms::has_hamiltonian_circuit;
pub use algorithms::has_hamiltonian_path;
pub use base::BipartiteGraph;
pub use base::DiGraph;
pub use base::Edge;
pub use base::EdgeWeight;
pub use base::Graph;
pub use base::Hyperedge;
pub use base::Hypergraph;
pub use base::MultiDiGraph;
pub use base::MultiGraph;
pub use base::Node;
pub use error::ErrorContext;
pub use error::GraphError;
pub use error::Result;
pub use generators::barabasi_albert_graph;
pub use generators::complete_graph;
pub use generators::cycle_graph;
pub use generators::erdos_renyi_graph;
pub use generators::grid_2d_graph;
pub use generators::grid_3d_graph;
pub use generators::hexagonal_lattice_graph;
pub use generators::path_graph;
pub use generators::planted_partition_model;
pub use generators::star_graph;
pub use generators::stochastic_block_model;
pub use generators::triangular_lattice_graph;
pub use generators::two_community_sbm;
pub use generators::watts_strogatz_graph;
pub use measures::centrality;
pub use measures::clustering_coefficient;
pub use measures::graph_density;
pub use measures::hits_algorithm;
pub use measures::katz_centrality;
pub use measures::katz_centrality_digraph;
pub use measures::pagerank_centrality;
pub use measures::pagerank_centrality_digraph;
pub use measures::CentralityType;
pub use measures::HitsScores;
pub use spectral::laplacian;
pub use spectral::normalized_cut;
pub use spectral::spectral_radius;
pub use weighted::MultiWeight;
pub use weighted::NormalizationMethod;
pub use weighted::WeightStatistics;
pub use weighted::WeightTransform;
pub use weighted::WeightedOps;
pub use attributes::AttributeSummary;
pub use attributes::AttributeValue;
pub use attributes::AttributeView;
pub use attributes::AttributedDiGraph;
pub use attributes::AttributedGraph;
pub use attributes::Attributes;
pub use memory::suggest_optimizations;
pub use memory::BitPackedGraph;
pub use memory::CSRGraph;
pub use memory::CompressedAdjacencyList;
pub use memory::FragmentationReport;
pub use memory::HybridGraph;
pub use memory::MemoryProfiler;
pub use memory::MemorySample;
pub use memory::MemoryStats;
pub use memory::OptimizationSuggestions;
pub use memory::OptimizedGraphBuilder;
pub use performance::LargeGraphIterator;
pub use performance::LargeGraphOps;
pub use performance::MemoryMetrics;
pub use performance::ParallelConfig;
pub use performance::PerformanceMonitor;
pub use performance::PerformanceReport;
pub use performance::StreamingGraphProcessor;
pub use embeddings::DeepWalk;
pub use embeddings::DeepWalkConfig;
pub use embeddings::Embedding;
pub use embeddings::EmbeddingModel;
pub use embeddings::Node2Vec;
pub use embeddings::Node2VecConfig;
pub use embeddings::RandomWalk;
pub use embeddings::RandomWalkGenerator;
pub use layout::circular_layout;
pub use layout::hierarchical_layout;
pub use layout::spectral_layout;
pub use layout::spring_layout;
pub use layout::Position;
pub use temporal::temporal_betweenness_centrality;
pub use temporal::temporal_reachability;
pub use temporal::TemporalGraph;
pub use temporal::TemporalPath;
pub use temporal::TimeInstant;
pub use temporal::TimeInterval;
pub use advanced::create_advanced_processor;
pub use advanced::execute_with_advanced;
pub use advanced::AdvancedConfig;
pub use advanced::AdvancedProcessor;
pub use advanced::AdvancedStats;
pub use advanced::AlgorithmMetrics;
pub use advanced::GPUAccelerationContext;
pub use advanced::NeuralRLAgent;
pub use advanced::NeuromorphicProcessor;
pub use graph_memory_profiler::AdvancedMemoryProfiler;
pub use graph_memory_profiler::EfficiencyAnalysis;
pub use graph_memory_profiler::MemoryProfile;
pub use graph_memory_profiler::MemoryProfilerConfig;
pub use graph_memory_profiler::MemoryStats as GraphMemoryStats;
pub use graph_memory_profiler::OptimizationOpportunity;
pub use graph_memory_profiler::OptimizationType;
pub use numerical_accuracy_validation::create_comprehensive_validation_suite;
pub use numerical_accuracy_validation::run_quick_validation;
pub use numerical_accuracy_validation::AdvancedNumericalValidator;
pub use numerical_accuracy_validation::ValidationAlgorithm;
pub use numerical_accuracy_validation::ValidationConfig;
pub use numerical_accuracy_validation::ValidationReport;
pub use numerical_accuracy_validation::ValidationResult;
pub use numerical_accuracy_validation::ValidationTolerances;
pub use io::*;

Modulesยง

advanced
Advanced Mode Integration for Graph Processing
algorithms
Graph algorithms
attributes
Node and edge attribute system
base
Base graph structures and operations
embeddings
Graph embedding algorithms and utilities
error
Error types for the graph processing module
generators
Graph generation algorithms
graph_memory_profiler
Memory Usage Profiler for Advanced Mode
io
Input/output operations for graphs
layout
Graph layout algorithms for visualization
measures
Graph measures and metrics
memory
Memory profiling and optimization utilities for graph data structures
numerical_accuracy_validation
Numerical Accuracy Validation for Advanced Mode
performance
Performance optimizations for large graph operations
spectral
Spectral graph theory operations
temporal
Temporal graph structures and algorithms
weighted
Specialized weighted graph operations and analysis

Traitsยง

IndexType
Trait for the unsigned integer type used for node and edge indices.