[−][src]Struct algorithms_edu::algo::graph::UnweightedAdjacencyList
An unweighted graph represented by an unweighted adjacency list.
This is in principle the same as WeightedAdjacencyList
, except that no weights are involved
and thus a simple usize
is able to represent an outgoing edge.
Implementations
impl UnweightedAdjacencyList
[src]
pub fn bfs(&self, start: usize) -> BfsResult
[src]
Perform a breadth first search on a graph a starting node start
.
impl UnweightedAdjacencyList
[src]
pub fn dfs_recursive(&self, start: usize) -> usize
[src]
impl UnweightedAdjacencyList
[src]
pub fn eulerian_path(&self) -> Result<Vec<usize>, EulerianPathError>
[src]
Returns a list of edge_count + 1
node ids that give the Eulerian path or
an EulerianPathError
if no path exists or the graph is disconnected.
impl UnweightedAdjacencyList
[src]
impl UnweightedAdjacencyList
[src]
pub fn center(&self) -> Center
[src]
Finds the center(s) of an undirected tree. The adjacency list must be build with undirected edges, and does not contain cycles, so that it qualifies the definition for a tree.
impl UnweightedAdjacencyList
[src]
pub fn is_isomorphic_with(&self, other: &UnweightedAdjacencyList) -> bool
[src]
impl UnweightedAdjacencyList
[src]
pub fn with_size(n: usize) -> Self
[src]
Initialize an empty adjacency list that can hold up to n nodes.
pub fn is_empty(&self) -> bool
[src]
pub fn add_directed_edge(&mut self, u: usize, v: usize)
[src]
Add a directed edge from node u
to node v
pub fn add_undirected_edge(&mut self, u: usize, v: usize)
[src]
Add an undirected edge between nodes u
and v
.
pub fn new_directed(size: usize, edges: &[[usize; 2]]) -> Self
[src]
pub fn new_undirected(size: usize, edges: &[[usize; 2]]) -> Self
[src]
pub fn edges(&self) -> impl Iterator<Item = [usize; 2]> + '_
[src]
Iterates over all edges in the gragh. Each item is an array of length 2, showing the source and destination of this edge.
pub fn edge_count(&self) -> usize
[src]
Number of edges in the graph
pub fn nodes(&self) -> impl Iterator<Item = (usize, &Vec<usize>)>
[src]
Iterates over all nodes in the graph.
Each item is a tuple of the node id and a Vec
of all its outgoing edges
pub fn node_count(&self) -> usize
[src]
Number of nodes (vertices) in the graph
Trait Implementations
impl BfsReconstructPath for UnweightedAdjacencyList
[src]
pub fn bfs<T: Queue<usize>>(&self, start: usize) -> Vec<Option<usize>>
[src]
Perform a breadth first search on a graph a starting node start
.
pub fn reconstruct_path<T: Queue<usize>>(
&self,
start: usize,
end: usize
) -> Vec<usize>
[src]
&self,
start: usize,
end: usize
) -> Vec<usize>
impl Debug for UnweightedAdjacencyList
[src]
impl Index<usize> for UnweightedAdjacencyList
[src]
Allows the outgoing edges of a node to be accessed easily.
Auto Trait Implementations
impl RefUnwindSafe for UnweightedAdjacencyList
[src]
impl Send for UnweightedAdjacencyList
[src]
impl Sync for UnweightedAdjacencyList
[src]
impl Unpin for UnweightedAdjacencyList
[src]
impl UnwindSafe for UnweightedAdjacencyList
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,