Back to Ruview

ruv-neural-mincut

rust-port/wifi-densepose-rs/crates/ruv-neural/ruv-neural-mincut/README.md

0.7.04.0 KB
Original Source

ruv-neural-mincut

Dynamic minimum cut analysis for brain network topology detection.

Overview

ruv-neural-mincut provides algorithms for computing minimum cuts on brain connectivity graphs, tracking topology changes over time, and detecting neural coherence events such as network formation, dissolution, merger, and split. These algorithms form the core of the rUv Neural cognitive state detection pipeline, identifying when brain network topology undergoes significant structural transitions.

Features

  • Stoer-Wagner (stoer_wagner): Global minimum cut in O(V^3) time, returning cut value, partitions, and cut edges
  • Normalized cut (normalized): Shi-Malik spectral bisection via the Fiedler vector for balanced graph partitioning
  • Multiway cut (multiway): Recursive normalized cut for k-module detection; detect_modules for automatic module count selection
  • Spectral cut (spectral_cut): Cheeger constant computation, spectral bisection, and Cheeger bound estimation
  • Dynamic tracking (dynamic): DynamicMincutTracker for temporal mincut evolution tracking with TopologyTransition and TransitionDirection detection
  • Coherence detection (coherence): CoherenceDetector identifying CoherenceEventType events (formation, dissolution, merger, split) from temporal graph sequences
  • Benchmarks (benchmark): Performance benchmarking utilities

Usage

rust
use ruv_neural_mincut::{
    stoer_wagner_mincut, normalized_cut, spectral_bisection,
    cheeger_constant, multiway_cut, detect_modules,
    DynamicMincutTracker, CoherenceDetector,
};
use ruv_neural_core::graph::BrainGraph;

// Compute global minimum cut
let result = stoer_wagner_mincut(&graph);
println!("Cut value: {:.3}", result.cut_value);
println!("Partition A: {:?}", result.partition_a);
println!("Partition B: {:?}", result.partition_b);

// Normalized cut (spectral bisection)
let ncut = normalized_cut(&graph);

// Spectral analysis
let (partition, cheeger) = spectral_bisection(&graph);
let h = cheeger_constant(&graph);

// Multiway cut for k modules
let multi = multiway_cut(&graph, 4);
let auto_modules = detect_modules(&graph);

// Track topology transitions over time
let mut tracker = DynamicMincutTracker::new();
for graph in &graph_sequence.graphs {
    let result = tracker.update(graph).unwrap();
}

// Detect coherence events
let mut detector = CoherenceDetector::new();
for graph in &graph_sequence.graphs {
    if let Some(event) = detector.check(graph) {
        println!("Event: {:?} at t={}", event.event_type, event.timestamp);
    }
}

API Reference

ModuleKey Types / Functions
stoer_wagnerstoer_wagner_mincut
normalizednormalized_cut
multiwaymultiway_cut, detect_modules
spectral_cutspectral_bisection, cheeger_constant, cheeger_bound
dynamicDynamicMincutTracker, TopologyTransition, TransitionDirection
coherenceCoherenceDetector, CoherenceEvent, CoherenceEventType
benchmarkBenchmark utilities

Feature Flags

FeatureDefaultDescription
stdYesStandard library support
wasmNoWASM-compatible implementations
sublinearNoSublinear mincut algorithms

Integration

Depends on ruv-neural-core for BrainGraph, MincutResult, and MultiPartition types. Receives graphs from ruv-neural-graph. Mincut results feed into ruv-neural-embed for topology-aware embeddings and ruv-neural-decoder for cognitive state classification.

License

MIT OR Apache-2.0