HyperNode

Trait HyperNode 

Source
pub trait HyperNode<T>: RawNode<T> {
    // Required methods
    fn index(&self) -> &VertexId<Self::Key>;
    fn weight(&self) -> &Weight<T>;
    fn weight_mut(&mut self) -> &mut Weight<T>;

    // Provided methods
    fn replace_weight(&mut self, weight: Weight<T>) -> Weight<T> { ... }
    fn set_weight(&mut self, weight: T) -> &mut Self { ... }
    fn swap_weight(&mut self, weight: &mut Weight<T>) { ... }
    fn take_weight(&mut self) -> Weight<T>
       where T: Default { ... }
}
Expand description

The HyperNode trait extends the RawNode trait to provide additional functionality for nodes in a hypergraph, such as accessing the index and weight of the node.

Required Methods§

Source

fn index(&self) -> &VertexId<Self::Key>

returns an immutable reference to the node index

Source

fn weight(&self) -> &Weight<T>

returns an immutable reference to the node data

Source

fn weight_mut(&mut self) -> &mut Weight<T>

returns a mutable reference to the node data

Provided Methods§

Source

fn replace_weight(&mut self, weight: Weight<T>) -> Weight<T>

replace the weight of the node with a new one, returning the previous value

Source

fn set_weight(&mut self, weight: T) -> &mut Self

overwrites the weight of the node with a new one and returns a mutable reference to the edge.

Source

fn swap_weight(&mut self, weight: &mut Weight<T>)

swap the weight of the node with another weight

Source

fn take_weight(&mut self) -> Weight<T>
where T: Default,

take the weight of the node, replacing it with a default value

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<T, Idx> HyperNode<T> for Node<T, Idx>
where Idx: RawIndex,