Struct UniqueGraph

Source
pub struct UniqueGraph<G>{ /* 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>

Source§

type Vertex = <G as BaseGraph>::Vertex

Type of the vertices in the graph.
Source§

type Weight = <G as BaseGraph>::Weight

Type of the weights in the graph.
Source§

type VertexIter = <G as BaseGraph>::VertexIter

Type of the collection returned with vertices.
Source§

type EdgeIter = <G as BaseGraph>::EdgeIter

Type of the collection returned with edges.
Source§

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

Returns copies of all current vertices in the graph.
Source§

fn all_edges(&self) -> Self::EdgeIter

Returns copies of all current edges in the graph.
Source§

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<(), ()>

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<(), ()>

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<(), ()>

Removes the given edge from the graph, assuming it is already present. Read more
Source§

fn vertex_count(&self) -> usize

Returns the number of vertices in the graph.
Source§

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,

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

Returns all edges that are connect to both the given vertices. Read more
Source§

fn edges_sourced_in(&self, v: Self::Vertex) -> Self::EdgeIter

Returns all edges that are sourced in the given vertex. Read more
Source§

fn edges_sinked_in(&self, v: Self::Vertex) -> Self::EdgeIter

Returns all edges that are sinked in the given vertex. Read more
Source§

impl<G> Clone for UniqueGraph<G>

Source§

fn clone(&self) -> UniqueGraph<G>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<G> ConstrainedGraph for UniqueGraph<G>

Source§

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<(), ()>

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<(), ()>

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<(), ()>

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<(), ()>

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>

Returns an Unconstrainer connected to the graph.
Source§

impl<G> Debug for UniqueGraph<G>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<G> GraphWrapper for UniqueGraph<G>

Source§

type Wrapped = G

Source§

fn wrap(g: Self::Wrapped) -> Self

Source§

fn wrapped(&self) -> &Self::Wrapped

Source§

fn wrapped_mut(&mut self) -> &mut Self::Wrapped

Source§

fn unwrap(self) -> Self::Wrapped

Source§

impl<G> Unique for UniqueGraph<G>

Auto Trait Implementations§

§

impl<G> Freeze for UniqueGraph<G>
where <G as BaseGraph>::Weight: Sized, <G as BaseGraph>::Vertex: Sized, G: Freeze,

§

impl<G> RefUnwindSafe for UniqueGraph<G>
where <G as BaseGraph>::Weight: Sized, <G as BaseGraph>::Vertex: Sized, G: RefUnwindSafe,

§

impl<G> Send for UniqueGraph<G>
where <G as BaseGraph>::Weight: Sized, <G as BaseGraph>::Vertex: Sized, G: Send,

§

impl<G> Sync for UniqueGraph<G>
where <G as BaseGraph>::Weight: Sized, <G as BaseGraph>::Vertex: Sized, G: Sync,

§

impl<G> Unpin for UniqueGraph<G>
where <G as BaseGraph>::Weight: Sized, <G as BaseGraph>::Vertex: Sized, G: Unpin,

§

impl<G> UnwindSafe for UniqueGraph<G>
where <G as BaseGraph>::Weight: Sized, <G as BaseGraph>::Vertex: Sized, G: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.