pub struct UniqueGraph<G>where
G: ConstrainedGraph,
<G as BaseGraph>::Vertex: Vertex,
<G as BaseGraph>::Weight: Weight,
<<G as BaseGraph>::VertexIter as IntoIterator>::IntoIter: ExactSizeIterator,
<<G as BaseGraph>::EdgeIter as IntoIterator>::IntoIter: ExactSizeIterator,{ /* private fields */ }
Expand description
A graph wrapper that enforces the Unique
constraint on any graph its given.
See <INSERT LINK TO Unique
> for a complete description.
Trait Implementations§
Source§impl<G> BaseGraph for UniqueGraph<G>where
G: ConstrainedGraph,
<G as BaseGraph>::Vertex: Vertex,
<G as BaseGraph>::Weight: Weight,
<<G as BaseGraph>::VertexIter as IntoIterator>::IntoIter: ExactSizeIterator,
<<G as BaseGraph>::EdgeIter as IntoIterator>::IntoIter: ExactSizeIterator,
impl<G> BaseGraph for UniqueGraph<G>where
G: ConstrainedGraph,
<G as BaseGraph>::Vertex: Vertex,
<G as BaseGraph>::Weight: Weight,
<<G as BaseGraph>::VertexIter as IntoIterator>::IntoIter: ExactSizeIterator,
<<G as BaseGraph>::EdgeIter as IntoIterator>::IntoIter: ExactSizeIterator,
Source§type VertexIter = <G as BaseGraph>::VertexIter
type VertexIter = <G as BaseGraph>::VertexIter
Type of the collection returned with vertices.
Source§fn empty_graph() -> Self
fn empty_graph() -> Self
Creates an empty graph. I.e a graph with no vertices and no edges. Read more
Source§fn all_vertices(&self) -> Self::VertexIter
fn all_vertices(&self) -> Self::VertexIter
Returns copies of all current vertices in the graph.
Source§fn add_vertex(&mut self, v: Self::Vertex) -> Result<(), ()>
fn add_vertex(&mut self, v: Self::Vertex) -> Result<(), ()>
Adds the given vertex to graph as long as no equal vertex is already
present i the graph and the graph is capable of storing it. Read more
Source§fn remove_vertex(&mut self, v: Self::Vertex) -> Result<(), ()>
fn remove_vertex(&mut self, v: Self::Vertex) -> Result<(), ()>
Removes the given vertex from the graph, assuming it is present. Read more
Source§fn add_edge(
&mut self,
e: BaseEdge<Self::Vertex, Self::Weight>,
) -> Result<(), ()>
fn add_edge( &mut self, e: BaseEdge<Self::Vertex, Self::Weight>, ) -> Result<(), ()>
Adds the given edge to the graph assuming it connects to valid vertices. Read more
Source§fn remove_edge(
&mut self,
e: BaseEdge<Self::Vertex, Self::Weight>,
) -> Result<(), ()>
fn remove_edge( &mut self, e: BaseEdge<Self::Vertex, Self::Weight>, ) -> Result<(), ()>
Removes the given edge from the graph, assuming it is already present. Read more
Source§fn vertex_count(&self) -> usize
fn vertex_count(&self) -> usize
Returns the number of vertices in the graph.
Source§fn edge_count(&self) -> usize
fn edge_count(&self) -> usize
Returns the number of edges in the graph.
Source§fn graph(
vertices: Vec<Self::Vertex>,
edges: Vec<(Self::Vertex, Self::Vertex, Self::Weight)>,
) -> Result<Self, ()>where
Self: Sized,
fn graph(
vertices: Vec<Self::Vertex>,
edges: Vec<(Self::Vertex, Self::Vertex, Self::Weight)>,
) -> Result<Self, ()>where
Self: Sized,
Creates a graph containing the given vertices and edges. There can be no
duplicate vertices and all edges must connect to the given vertices. Read more
Source§fn edges_between(&self, v1: Self::Vertex, v2: Self::Vertex) -> Self::EdgeIter
fn edges_between(&self, v1: Self::Vertex, v2: Self::Vertex) -> Self::EdgeIter
Returns all edges that are connect to both the given vertices. Read more
Source§impl<G> Clone for UniqueGraph<G>where
G: ConstrainedGraph + Clone,
<G as BaseGraph>::Vertex: Vertex,
<G as BaseGraph>::Weight: Weight,
<<G as BaseGraph>::VertexIter as IntoIterator>::IntoIter: ExactSizeIterator,
<<G as BaseGraph>::EdgeIter as IntoIterator>::IntoIter: ExactSizeIterator,
impl<G> Clone for UniqueGraph<G>where
G: ConstrainedGraph + Clone,
<G as BaseGraph>::Vertex: Vertex,
<G as BaseGraph>::Weight: Weight,
<<G as BaseGraph>::VertexIter as IntoIterator>::IntoIter: ExactSizeIterator,
<<G as BaseGraph>::EdgeIter as IntoIterator>::IntoIter: ExactSizeIterator,
Source§fn clone(&self) -> UniqueGraph<G>
fn clone(&self) -> UniqueGraph<G>
Returns a duplicate 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<G> ConstrainedGraph for UniqueGraph<G>where
G: ConstrainedGraph,
<G as BaseGraph>::Vertex: Vertex,
<G as BaseGraph>::Weight: Weight,
<<G as BaseGraph>::VertexIter as IntoIterator>::IntoIter: ExactSizeIterator,
<<G as BaseGraph>::EdgeIter as IntoIterator>::IntoIter: ExactSizeIterator,
impl<G> ConstrainedGraph for UniqueGraph<G>where
G: ConstrainedGraph,
<G as BaseGraph>::Vertex: Vertex,
<G as BaseGraph>::Weight: Weight,
<<G as BaseGraph>::VertexIter as IntoIterator>::IntoIter: ExactSizeIterator,
<<G as BaseGraph>::EdgeIter as IntoIterator>::IntoIter: ExactSizeIterator,
Source§fn invariant_holds(&self) -> bool
fn invariant_holds(&self) -> bool
Checks whether the current state of the graph upholds the constraint invariant.
Source§unsafe fn uncon_add_vertex(&mut self, v: Self::Vertex) -> Result<(), ()>
unsafe fn uncon_add_vertex(&mut self, v: Self::Vertex) -> Result<(), ()>
Adds the given vertex to the graph without upholding the constraint invariant. Read more
Source§unsafe fn uncon_remove_vertex(&mut self, v: Self::Vertex) -> Result<(), ()>
unsafe fn uncon_remove_vertex(&mut self, v: Self::Vertex) -> Result<(), ()>
Removes the given vertex from the graph without upholding the constraint invariant. Read more
Source§unsafe fn uncon_add_edge(
&mut self,
e: BaseEdge<Self::Vertex, Self::Weight>,
) -> Result<(), ()>
unsafe fn uncon_add_edge( &mut self, e: BaseEdge<Self::Vertex, Self::Weight>, ) -> Result<(), ()>
Adds the given edge to the graph without upholding the constraint invariant. Read more
Source§unsafe fn uncon_remove_edge(
&mut self,
e: BaseEdge<Self::Vertex, Self::Weight>,
) -> Result<(), ()>
unsafe fn uncon_remove_edge( &mut self, e: BaseEdge<Self::Vertex, Self::Weight>, ) -> Result<(), ()>
Removes the given edge from the graph without upholding the constraint invariant.
Source§fn unconstrained<'a>(
&'a mut self,
) -> Unconstrainer<'_, Self::Vertex, Self::Weight, Self::VertexIter, Self::EdgeIter, Self>
fn unconstrained<'a>( &'a mut self, ) -> Unconstrainer<'_, Self::Vertex, Self::Weight, Self::VertexIter, Self::EdgeIter, Self>
Returns an
Unconstrainer
connected to the graph.Source§impl<G> Debug for UniqueGraph<G>where
G: ConstrainedGraph + Debug,
<G as BaseGraph>::Vertex: Vertex,
<G as BaseGraph>::Weight: Weight,
<<G as BaseGraph>::VertexIter as IntoIterator>::IntoIter: ExactSizeIterator,
<<G as BaseGraph>::EdgeIter as IntoIterator>::IntoIter: ExactSizeIterator,
impl<G> Debug for UniqueGraph<G>where
G: ConstrainedGraph + Debug,
<G as BaseGraph>::Vertex: Vertex,
<G as BaseGraph>::Weight: Weight,
<<G as BaseGraph>::VertexIter as IntoIterator>::IntoIter: ExactSizeIterator,
<<G as BaseGraph>::EdgeIter as IntoIterator>::IntoIter: ExactSizeIterator,
Source§impl<G> GraphWrapper for UniqueGraph<G>where
G: ConstrainedGraph,
<G as BaseGraph>::Vertex: Vertex,
<G as BaseGraph>::Weight: Weight,
<<G as BaseGraph>::VertexIter as IntoIterator>::IntoIter: ExactSizeIterator,
<<G as BaseGraph>::EdgeIter as IntoIterator>::IntoIter: ExactSizeIterator,
impl<G> GraphWrapper for UniqueGraph<G>where
G: ConstrainedGraph,
<G as BaseGraph>::Vertex: Vertex,
<G as BaseGraph>::Weight: Weight,
<<G as BaseGraph>::VertexIter as IntoIterator>::IntoIter: ExactSizeIterator,
<<G as BaseGraph>::EdgeIter as IntoIterator>::IntoIter: ExactSizeIterator,
impl<G> Unique for UniqueGraph<G>where
G: ConstrainedGraph,
<G as BaseGraph>::Vertex: Vertex,
<G as BaseGraph>::Weight: Weight,
<<G as BaseGraph>::VertexIter as IntoIterator>::IntoIter: ExactSizeIterator,
<<G as BaseGraph>::EdgeIter as IntoIterator>::IntoIter: ExactSizeIterator,
Auto Trait Implementations§
impl<G> Freeze for UniqueGraph<G>
impl<G> RefUnwindSafe for UniqueGraph<G>
impl<G> Send for UniqueGraph<G>
impl<G> Sync for UniqueGraph<G>
impl<G> Unpin for UniqueGraph<G>
impl<G> UnwindSafe for UniqueGraph<G>
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