pub struct SubGraphBuilder {
pub vertex_num: VertexNum,
pub complete_graph: CompleteGraph,
pub subgraph: BTreeSet<EdgeIndex>,
/* private fields */
}Expand description
build a subgraph based on minimum-weight paths between matched pairs
Fields§
§vertex_num: VertexNumnumber of vertices
complete_graph: CompleteGraphan instance of complete graph to compute minimum-weight path between any pair of vertices
subgraph: BTreeSet<EdgeIndex>current subgraph, assuming edges are not very much
Implementations§
Source§impl SubGraphBuilder
impl SubGraphBuilder
pub fn new(initializer: &SolverInitializer) -> Self
pub fn clear(&mut self)
Sourcepub fn load_erasures(&mut self, erasures: &[EdgeIndex])
pub fn load_erasures(&mut self, erasures: &[EdgeIndex])
temporarily set some edges to 0 weight, and when it resets, those edges will be reverted back to the original weight
pub fn load_dynamic_weights(&mut self, dynamic_weights: &[(EdgeIndex, Weight)])
Sourcepub fn load_perfect_matching(&mut self, perfect_matching: &PerfectMatching)
pub fn load_perfect_matching(&mut self, perfect_matching: &PerfectMatching)
load perfect matching to the subgraph builder
pub fn load_subgraph(&mut self, subgraph: &[EdgeIndex])
Sourcepub fn add_matching(&mut self, vertex_1: VertexIndex, vertex_2: VertexIndex)
pub fn add_matching(&mut self, vertex_1: VertexIndex, vertex_2: VertexIndex)
add a matching, finding the minimum path and XOR them into the subgraph (if adding the same pair twice, they will cancel each other)
Sourcepub fn total_weight(&self) -> Weight
pub fn total_weight(&self) -> Weight
get the total weight of the subgraph
Sourcepub fn get_subgraph(&self) -> Vec<EdgeIndex> ⓘ
pub fn get_subgraph(&self) -> Vec<EdgeIndex> ⓘ
get subgraph as a vec
Trait Implementations§
Source§impl Clone for SubGraphBuilder
impl Clone for SubGraphBuilder
Source§fn clone(&self) -> SubGraphBuilder
fn clone(&self) -> SubGraphBuilder
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for SubGraphBuilder
impl RefUnwindSafe for SubGraphBuilder
impl Send for SubGraphBuilder
impl Sync for SubGraphBuilder
impl Unpin for SubGraphBuilder
impl UnwindSafe for SubGraphBuilder
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)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>
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 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>
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