pub struct FloydWarshallAlgorithm {
pub total_nodes: usize,
pub edges: Vec<(usize, usize, i32)>,
}
Expand description
Floyd-Warshall Algorithm. Compute shortest paths between all pairs of vertices in a weighted graph.
Fields§
§total_nodes: usize
Total number of nodes in the graph.
edges: Vec<(usize, usize, i32)>
Edges in the graph.
Implementations§
Source§impl FloydWarshallAlgorithm
impl FloydWarshallAlgorithm
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new instance of Floyd-Warshall Algorithm.
§Returns
New instance of Floyd-Warshall Algorithm.
Sourcepub fn set_edge(&mut self, source: usize, target: usize, weight: i32)
pub fn set_edge(&mut self, source: usize, target: usize, weight: i32)
Set a single edge to the graph.
§Arguments
source
: Source node.target
: Target node.weight
: Weight of the edge.
Sourcepub fn set_edges(&mut self, nodes: Vec<(usize, Vec<(usize, i32)>)>)
pub fn set_edges(&mut self, nodes: Vec<(usize, Vec<(usize, i32)>)>)
Set multiple nodes’ edges to the graph.
§Arguments
nodes
: Vector of tuples where each tuple contains a node and its associated edges.
Sourcepub fn set_total_nodes(&mut self, total: usize)
pub fn set_total_nodes(&mut self, total: usize)
Trait Implementations§
Source§impl Clone for FloydWarshallAlgorithm
impl Clone for FloydWarshallAlgorithm
Source§fn clone(&self) -> FloydWarshallAlgorithm
fn clone(&self) -> FloydWarshallAlgorithm
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for FloydWarshallAlgorithm
impl Debug for FloydWarshallAlgorithm
Source§impl Default for FloydWarshallAlgorithm
impl Default for FloydWarshallAlgorithm
Auto Trait Implementations§
impl Freeze for FloydWarshallAlgorithm
impl RefUnwindSafe for FloydWarshallAlgorithm
impl Send for FloydWarshallAlgorithm
impl Sync for FloydWarshallAlgorithm
impl Unpin for FloydWarshallAlgorithm
impl UnwindSafe for FloydWarshallAlgorithm
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)