pub struct CompleteGraph {
pub vertex_num: VertexNum,
pub vertices: Vec<CompleteGraphVertex>,
pub edge_modifier: EdgeWeightModifier,
pub weighted_edges: Vec<(VertexIndex, VertexIndex, Weight)>,
/* private fields */
}Expand description
build complete graph out of skeleton graph using Dijkstra’s algorithm
Fields§
§vertex_num: VertexNumnumber of vertices
vertices: Vec<CompleteGraphVertex>the vertices to run Dijkstra’s algorithm
edge_modifier: EdgeWeightModifierremember the edges that’s modified by erasures
weighted_edges: Vec<(VertexIndex, VertexIndex, Weight)>original edge weights
Implementations§
Source§impl CompleteGraph
impl CompleteGraph
Sourcepub fn new(
vertex_num: VertexNum,
weighted_edges: &[(VertexIndex, VertexIndex, Weight)],
) -> Self
pub fn new( vertex_num: VertexNum, weighted_edges: &[(VertexIndex, VertexIndex, Weight)], ) -> Self
create complete graph given skeleton graph
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 invalidate_previous_dijkstra(&mut self) -> usize
pub fn invalidate_previous_dijkstra(&mut self) -> usize
invalidate Dijkstra’s algorithm state from previous call
Sourcepub fn all_edges_with_terminate(
&mut self,
vertex: VertexIndex,
terminate: VertexIndex,
) -> BTreeMap<VertexIndex, (VertexIndex, Weight)>
pub fn all_edges_with_terminate( &mut self, vertex: VertexIndex, terminate: VertexIndex, ) -> BTreeMap<VertexIndex, (VertexIndex, Weight)>
get all complete graph edges from the specific vertex, but will terminate if terminate vertex is found
Sourcepub fn all_edges(
&mut self,
vertex: VertexIndex,
) -> BTreeMap<VertexIndex, (VertexIndex, Weight)>
pub fn all_edges( &mut self, vertex: VertexIndex, ) -> BTreeMap<VertexIndex, (VertexIndex, Weight)>
get all complete graph edges from the specific vertex
Sourcepub fn get_path(
&mut self,
a: VertexIndex,
b: VertexIndex,
) -> (Vec<(VertexIndex, Weight)>, Weight)
pub fn get_path( &mut self, a: VertexIndex, b: VertexIndex, ) -> (Vec<(VertexIndex, Weight)>, Weight)
get minimum-weight path between any two vertices a and b, in the order a -> path[0].0 -> path[1].0 -> .... -> path[-1].0 and it’s guaranteed that path[-1].0 = b
Trait Implementations§
Source§impl Clone for CompleteGraph
impl Clone for CompleteGraph
Source§fn clone(&self) -> CompleteGraph
fn clone(&self) -> CompleteGraph
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 CompleteGraph
impl RefUnwindSafe for CompleteGraph
impl Send for CompleteGraph
impl Sync for CompleteGraph
impl Unpin for CompleteGraph
impl UnwindSafe for CompleteGraph
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