pub struct AdjacentListGraph(/* private fields */);
Expand description
An undirected graph implemented by adjacent lists.
Complexity | |
---|---|
add_vertex | $O(1)$ |
add_edge | $O(1)$ |
remove_edge | $O(|E’|)$, where $E’$ is the set of edges sharing the same endpoints of edge to remove. |
remove_vertex | $O(|E’|)$ calls to remove_edge , where $E’$ is the set of edges connecting to the vertex to remove. |
vertex_size | $O(1)$ |
iter_vertices | $O(1)$ per call to .next() . |
contains_vertex | $O(1)$ |
edge_size | $O(1)$ |
iter_edges | $O(1)$ per call to .next() . |
contains_edge | $O(1)$ |
find_edge | $O(1)$ |
edges_connecting | returns in $O(1)$. $O(1)$ on each call to .next . |
in_edges | returns in $O(1)$. $O(1)$ on each call to .next . |
out_edges | returns in $O(1)$. $O(1)$ on each call to .next . |
Trait Implementations§
Source§impl Clone for AdjacentListGraph
impl Clone for AdjacentListGraph
Source§fn clone(&self) -> AdjacentListGraph
fn clone(&self) -> AdjacentListGraph
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 DirectedOrNot for AdjacentListGraph
impl DirectedOrNot for AdjacentListGraph
Source§const DIRECTED_OR_NOT: bool = false
const DIRECTED_OR_NOT: bool = false
When the graph is directed, it is true; otherwise, it is false.
Source§impl GrowableGraph for AdjacentListGraph
impl GrowableGraph for AdjacentListGraph
Source§impl QueryableGraph for AdjacentListGraph
impl QueryableGraph for AdjacentListGraph
Source§fn vertex_size(&self) -> usize
fn vertex_size(&self) -> usize
Number of vertices in the graph.
Source§fn iter_vertices(&self) -> Box<dyn Iterator<Item = VertexId> + '_>
fn iter_vertices(&self) -> Box<dyn Iterator<Item = VertexId> + '_>
Iteration over all vertices in the graph.
Source§fn contains_vertex(&self, v: &VertexId) -> bool
fn contains_vertex(&self, v: &VertexId) -> bool
Whether a vertex is in the graph or not.
Source§fn iter_edges(&self) -> Box<dyn Iterator<Item = Edge> + '_>
fn iter_edges(&self) -> Box<dyn Iterator<Item = Edge> + '_>
Iteration over all edges in the graph.
Source§fn contains_edge(&self, e: &EdgeId) -> bool
fn contains_edge(&self, e: &EdgeId) -> bool
Whether an edge is in the graph or not.
Source§fn find_edge(&self, e: &EdgeId) -> Option<Edge>
fn find_edge(&self, e: &EdgeId) -> Option<Edge>
Returns information about a specified edge in the graph.
Source§fn in_edges(&self, v: &VertexId) -> Box<dyn Iterator<Item = Edge> + '_>
fn in_edges(&self, v: &VertexId) -> Box<dyn Iterator<Item = Edge> + '_>
Iteration over all edges going into the vertex
v
. Read moreSource§fn out_edges(&self, v: &VertexId) -> Box<dyn Iterator<Item = Edge> + '_>
fn out_edges(&self, v: &VertexId) -> Box<dyn Iterator<Item = Edge> + '_>
Iteration over all edges going out of
v
. Read moreSource§fn edges_connecting(
&self,
source: &VertexId,
sink: &VertexId,
) -> Box<dyn Iterator<Item = Edge> + '_>
fn edges_connecting( &self, source: &VertexId, sink: &VertexId, ) -> Box<dyn Iterator<Item = Edge> + '_>
Iteration over all edges between two vertices in undirected graphs
or those from
source
to sink
in directed graphs.Auto Trait Implementations§
impl Freeze for AdjacentListGraph
impl RefUnwindSafe for AdjacentListGraph
impl Send for AdjacentListGraph
impl Sync for AdjacentListGraph
impl Unpin for AdjacentListGraph
impl UnwindSafe for AdjacentListGraph
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