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]
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.
Implementors
impl<W> Edge<W> for DefaultEdge<W>
[src]
impl<W> Edge<W> for DefaultEdge<W>
[src]For documentation about each function checkout Edge
trait.
fn init(weight: Magnitude<W>) -> Self
[src]
fn get_weight(&self) -> &Magnitude<W>
[src]
Complexity
O(1)
fn set_weight(&mut self, weight: Magnitude<W>)
[src]
Complexity
O(1)
fn set_id(&mut self, id: usize)
[src]
Complexity
O(1)
fn get_id(&self) -> usize
[src]
Complexity
O(1)