Struct SimpleGraph

Source
pub struct SimpleGraph<Vertex, Edge>
where Vertex: Element, Edge: Element,
{ /* private fields */ }
Expand description

A graph that is backed by a simple in-memory data structure.

Implementations§

Source§

impl<Vertex, Edge> SimpleGraph<Vertex, Edge>
where Vertex: Element, Edge: Element,

Source

pub fn new() -> Self

Trait Implementations§

Source§

impl<Vertex, Edge> Debug for SimpleGraph<Vertex, Edge>
where Vertex: Element, Edge: Element,

Source§

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

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

impl<Vertex, Edge> Default for SimpleGraph<Vertex, Edge>
where Vertex: Element, Edge: Element,

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<Vertex, Edge> Graph for SimpleGraph<Vertex, Edge>
where Vertex: Element, Edge: Element,

Source§

type Vertex = Vertex

The type of the vertices in the graph. This is usually an enum.
Source§

type Edge = Edge

The type of the edges in the graph. This is usually an enum.
Source§

type VertexId = VertexId

The VertexId type of the graph.
Source§

type EdgeId = EdgeId

The EdgeId type of the graph.
Source§

type VertexReference<'graph> = VertexReference<'graph, SimpleGraph<Vertex, Edge>> where Self: 'graph

A reference to a vertex.
Source§

type VertexReferenceMut<'graph> = VertexReferenceMut<'graph, SimpleGraph<Vertex, Edge>> where Self: 'graph

A mut reference to a vertex.
Source§

type EdgeReference<'graph> = EdgeReference<'graph, SimpleGraph<Vertex, Edge>> where Self: 'graph

An edge reference is used during walking over edges. It includes the id, tail, head and weight of the edge.
Source§

type EdgeReferenceMut<'graph> = EdgeReferenceMut<'graph, SimpleGraph<Vertex, Edge>> where Self: 'graph

A mut edge reference to modify the edge.
Source§

type EdgeIter<'search, 'graph> = EdgeIter<'search, 'graph, SimpleGraph<Vertex, Edge>> where Self: 'graph

An iterator over the edge references.
Source§

type VertexIter<'search, 'graph> = VertexIter<'search, 'graph, SimpleGraph<Vertex, Edge>> where Self: 'graph

An iterator over the vertex references.
Source§

fn add_vertex(&mut self, vertex: Self::Vertex) -> Self::VertexId

Adds a vertex to the graph and returns its identifier.
Source§

fn add_edge( &mut self, from: Self::VertexId, to: Self::VertexId, edge: Self::Edge, ) -> Self::EdgeId

Adds an edge to the graph and returns its identifier.
Source§

fn vertex(&self, id: Self::VertexId) -> Option<Self::VertexReference<'_>>

Gets the vertex with the specified identifier.
Source§

fn vertex_mut( &mut self, id: Self::VertexId, ) -> Option<Self::VertexReferenceMut<'_>>

Returns the vertex with the specified identifier.
Source§

fn vertices<'search>( &self, search: &VertexSearch<'search, Self>, ) -> Self::VertexIter<'search, '_>

Iterate over vertex identifiers. Graphs should try to narrow down the returned vertices using the search criteria, but overfetch will be filtered.
Source§

fn edge(&self, id: Self::EdgeId) -> Option<Self::EdgeReference<'_>>

Gets the edge with the specified identifier.
Source§

fn edge_mut(&mut self, edge: Self::EdgeId) -> Option<Self::EdgeReferenceMut<'_>>

Gets the edge with the specified identifier.
Source§

fn edges<'search>( &self, vertex: Self::VertexId, search: &EdgeSearch<'search, Self>, ) -> Self::EdgeIter<'search, '_>

Returns an iterator over the edges of a vertex. Graphs should try to narrow down the returned edges using the search criteria, but overfetch will be filtered.
Source§

fn clear(&mut self)

Clears the graph. Default implementation returns an error. Implement the SupportsClear trait to provide this functionality.
Source§

fn dbg<T>(&self, id: T) -> String
where T: Into<ElementId<Self>>,

Returns a string representation of an element in the graph.
Source§

fn walk(&self) -> StartWalkerBuilder<'_, ImmutableMarker, Self, ()>
where Self: Sized,

Returns an immutable walker builder for the graph.
Source§

fn walk_mut(&mut self) -> StartWalkerBuilder<'_, MutableMarker, Self, ()>
where Self: Sized,

Returns a mutable walker builder for the graph.
Source§

impl<Vertex, Edge> SupportsClear for SimpleGraph<Vertex, Edge>
where Vertex: Element, Edge: Element,

Source§

fn clear(&mut self)

Clears the graph, removing all vertices and edges
Source§

impl<Vertex, Edge> SupportsElementRemoval for SimpleGraph<Vertex, Edge>
where Vertex: Element, Edge: Element,

Source§

fn remove_vertex(&mut self, id: Self::VertexId) -> Option<Self::Vertex>

Removes a vertex from the graph and returns the vertex.
Source§

fn remove_edge(&mut self, edge: Self::EdgeId) -> Option<Self::Edge>

Removes an edge from the graph and returns the edge.
Source§

impl<Vertex, Edge> SupportsEdgeAdjacentLabelIndex for SimpleGraph<Vertex, Edge>
where Vertex: Element, Edge: Element,

Source§

impl<Vertex, Edge> SupportsEdgeHashIndex for SimpleGraph<Vertex, Edge>
where Vertex: Element, Edge: Element,

Source§

impl<Vertex, Edge> SupportsEdgeLabelIndex for SimpleGraph<Vertex, Edge>
where Vertex: Element, Edge: Element,

Source§

impl<Vertex, Edge> SupportsEdgeRangeIndex for SimpleGraph<Vertex, Edge>
where Vertex: Element, Edge: Element,

Source§

impl<Vertex, Edge> SupportsVertexFullTextIndex for SimpleGraph<Vertex, Edge>
where Vertex: Element, Edge: Element,

Source§

impl<Vertex, Edge> SupportsVertexHashIndex for SimpleGraph<Vertex, Edge>
where Vertex: Element, Edge: Element,

Source§

impl<Vertex, Edge> SupportsVertexLabelIndex for SimpleGraph<Vertex, Edge>
where Vertex: Element, Edge: Element,

Source§

impl<Vertex, Edge> SupportsVertexRangeIndex for SimpleGraph<Vertex, Edge>
where Vertex: Element, Edge: Element,

Auto Trait Implementations§

§

impl<Vertex, Edge> Freeze for SimpleGraph<Vertex, Edge>

§

impl<Vertex, Edge> RefUnwindSafe for SimpleGraph<Vertex, Edge>
where Edge: RefUnwindSafe, Vertex: RefUnwindSafe,

§

impl<Vertex, Edge> Send for SimpleGraph<Vertex, Edge>
where Edge: Send, Vertex: Send,

§

impl<Vertex, Edge> Sync for SimpleGraph<Vertex, Edge>
where Edge: Sync, Vertex: Sync,

§

impl<Vertex, Edge> Unpin for SimpleGraph<Vertex, Edge>
where Edge: Unpin, Vertex: Unpin,

§

impl<Vertex, Edge> UnwindSafe for SimpleGraph<Vertex, Edge>
where Edge: UnwindSafe, Vertex: 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> 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. 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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V