InstanceResult

Enum InstanceResult 

Source
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 set
  • witness: A witness handle certifying the cut

Fields

§value: u64

The minimum proper cut value

§witness: WitnessHandle

Witness 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

Source

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());
Source

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());
Source

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);
Source

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

Source§

fn clone(&self) -> InstanceResult

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for InstanceResult

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V