pub enum InstanceResult {
ValueInRange {
value: u64,
witness: WitnessHandle,
},
AboveRange,
}Expand description
Result from a bounded-range instance query
Represents the outcome of querying a minimum proper cut instance. The instance either finds a cut within the bounded range [λ_min, λ_max] or determines that the minimum cut exceeds λ_max.
Variants§
ValueInRange
Cut value is within [λ_min, λ_max], with witness
The witness certifies that a proper cut exists with the given value. The value is guaranteed to be in the range [λ_min, λ_max].
§Fields
value: The cut value |δ(U)| where U is the witness setwitness: A witness handle certifying the cut
AboveRange
Cut value exceeds λ_max
The instance has detected that the minimum proper cut value is strictly greater than λ_max. No witness is provided because maintaining witnesses above the range is not required.
This typically triggers a range adjustment in the outer algorithm.
Implementations§
Source§impl InstanceResult
impl InstanceResult
Sourcepub fn is_in_range(&self) -> bool
pub fn is_in_range(&self) -> bool
Check if result is in range
§Examples
use ruvector_mincut::instance::traits::InstanceResult;
use ruvector_mincut::instance::witness::WitnessHandle;
use roaring::RoaringBitmap;
let witness = WitnessHandle::new(0, RoaringBitmap::from_iter([0, 1]), 5);
let result = InstanceResult::ValueInRange { value: 5, witness };
assert!(result.is_in_range());
let result = InstanceResult::AboveRange;
assert!(!result.is_in_range());Sourcepub fn is_above_range(&self) -> bool
pub fn is_above_range(&self) -> bool
Check if result is above range
§Examples
use ruvector_mincut::instance::traits::InstanceResult;
let result = InstanceResult::AboveRange;
assert!(result.is_above_range());Sourcepub fn value(&self) -> Option<u64>
pub fn value(&self) -> Option<u64>
Get the cut value if in range
§Examples
use ruvector_mincut::instance::traits::InstanceResult;
use ruvector_mincut::instance::witness::WitnessHandle;
use roaring::RoaringBitmap;
let witness = WitnessHandle::new(0, RoaringBitmap::from_iter([0]), 7);
let result = InstanceResult::ValueInRange { value: 7, witness };
assert_eq!(result.value(), Some(7));
let result = InstanceResult::AboveRange;
assert_eq!(result.value(), None);Sourcepub fn witness(&self) -> Option<&WitnessHandle>
pub fn witness(&self) -> Option<&WitnessHandle>
Get the witness if in range
§Examples
use ruvector_mincut::instance::traits::InstanceResult;
use ruvector_mincut::instance::witness::WitnessHandle;
use roaring::RoaringBitmap;
let witness = WitnessHandle::new(0, RoaringBitmap::from_iter([0]), 7);
let result = InstanceResult::ValueInRange { value: 7, witness: witness.clone() };
assert!(result.witness().is_some());
let result = InstanceResult::AboveRange;
assert!(result.witness().is_none());Trait Implementations§
Source§impl Clone for InstanceResult
impl Clone for InstanceResult
Source§fn clone(&self) -> InstanceResult
fn clone(&self) -> InstanceResult
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for InstanceResult
impl RefUnwindSafe for InstanceResult
impl Send for InstanceResult
impl Sync for InstanceResult
impl Unpin for InstanceResult
impl UnwindSafe for InstanceResult
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more