DynamicWeightedComponent

Trait DynamicWeightedComponent 

Source
pub trait DynamicWeightedComponent<W = EmptyWeight, Ix = DefaultIndexType>
where W: WeightType, Ix: IndexType,
{ // Required methods fn set_vertex_weight(&mut self, v: VertexIndex<Ix>, weight: W) -> Option<W>; fn vertex_weight(&self, v: VertexIndex<Ix>) -> Option<&W>; fn component_weight(&self, v: VertexIndex<Ix>) -> Option<&W>; fn adjust_vertex_weight( &mut self, v: VertexIndex<Ix>, f: &dyn Fn(&mut W), ) -> Option<&W>; }
Expand description

This trait defines the fundamental operations of a dynamic graph related to vertex weights, that can be applied to a connected sub-graph, that is, the connected components of the graph.

Required Methods§

Source

fn set_vertex_weight(&mut self, v: VertexIndex<Ix>, weight: W) -> Option<W>

Set the weight of the vertex indexed by v to weight and update the weight of the component this vertex belongs to. If v was a valid index, the old weight is returned.

Source

fn vertex_weight(&self, v: VertexIndex<Ix>) -> Option<&W>

Immutably access the weight of the vertex indexed by v.

Source

fn component_weight(&self, v: VertexIndex<Ix>) -> Option<&W>

Immutably access the weight of the component to which the vertex indexed by v belongs.

Source

fn adjust_vertex_weight( &mut self, v: VertexIndex<Ix>, f: &dyn Fn(&mut W), ) -> Option<&W>

Change the weight of the vertex indexed by v by applying the closure f. After applying the closure, the weight of the component this vertex belongs to will be updated accordingly. If v was a valid index a reference to the changed weight is returned.

Implementors§