Trait prepona::prelude::Edge[][src]

pub trait Edge<W> {
    fn init(weight: Magnitude<W>) -> Self;
fn get_weight(&self) -> &Magnitude<W>;
fn set_weight(&mut self, weight: Magnitude<W>);
fn set_id(&mut self, id: usize);
fn get_id(&self) -> usize; }

Define necessary functionality for a struct to act as an edge of a graph.

You can define your own custom edges and after implementing Edge trait for them, you can store them in any storage. As an example checkout FlowEdge.

Required methods

fn init(weight: Magnitude<W>) -> Self[src]

Arguments

weight: Weight of the edge.

Returns

Initialized edge with the specified weight.

fn get_weight(&self) -> &Magnitude<W>[src]

Returns

The weight of the edge.

fn set_weight(&mut self, weight: Magnitude<W>)[src]

Arguments

weight: New weight of the edge.

fn set_id(&mut self, id: usize)[src]

Arguments

id: Unique id of the edge.

fn get_id(&self) -> usize[src]

Returns

Id of the edge.

Loading content...

Implementors

impl<W> Edge<W> for FlowEdge<W>[src]

For documentation about each function checkout Edge trait.

impl<W> Edge<W> for DefaultEdge<W>[src]

For documentation about each function checkout Edge trait.

fn get_weight(&self) -> &Magnitude<W>[src]

fn set_weight(&mut self, weight: Magnitude<W>)[src]

fn set_id(&mut self, id: usize)[src]

fn get_id(&self) -> usize[src]

Loading content...