Struct SimpleGraph

Source
pub struct SimpleGraph<N, E> { /* private fields */ }
Expand description

A simple graph representation that is inefficient to use, but cheap to construct.

For actual usage, the graph should be converted into a different representation.

Trait Implementations§

Source§

impl<N: Debug, E: Debug> Debug for SimpleGraph<N, E>

Source§

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

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

impl<N, E> Default for SimpleGraph<N, E>

Source§

fn default() -> Self

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

impl<N: Clone, E: Clone> From<&AdjacencyArray<N, E>> for SimpleGraph<N, E>

Source§

fn from(source: &AdjacencyArray<N, E>) -> Self

Converts to this type from the input type.
Source§

impl<N: Clone, E: Default + Clone> From<&SimpleGraph<N, E>> for AdjacencyArray<N, E>

Source§

fn from(source: &SimpleGraph<N, E>) -> Self

Converts to this type from the input type.
Source§

impl<N, E> Graph<N, E> for SimpleGraph<N, E>

Source§

type NodeIdIterator = Map<Range<u32>, fn(u32) -> NodeId>

An iterator over all node ids of a graph.
Source§

type EdgeIdIterator = Map<Range<u32>, fn(u32) -> EdgeId>

An iterator over all edge ids of a graph.
Source§

fn node_len(&self) -> IdType

The amount of nodes in the graph.
Source§

fn edge_len(&self) -> IdType

The amount of edges in the graph.
Source§

fn node_id_iter(&self) -> Self::NodeIdIterator

Returns an iterator over all node ids in the graph.
Source§

fn edge_id_iter(&self) -> Self::EdgeIdIterator

Returns an iterator over all edge ids in the graph.
Source§

fn node_data(&self, id: NodeId) -> &N

Returns a reference to a nodes data, identified by the given id.
Source§

fn edge_data(&self, id: EdgeId) -> &E

Returns a reference to an edges data, identified by the given id.
Source§

fn edge(&self, id: EdgeId) -> EdgeRef<'_, E>

Returns an edge instance, identified by the given id.
Source§

fn edge_start(&self, id: EdgeId) -> NodeId

Returns the start node of the edge identified by the given id.
Source§

fn edge_end(&self, id: EdgeId) -> NodeId

Returns the end node of the edge identified by the given id.
Source§

fn is_node_id_valid(&self, id: NodeId) -> bool

Returns true if the given NodeId refers to a node in this graph.
Source§

fn is_edge_id_valid(&self, id: EdgeId) -> bool

Returns true if the given EdgeId refers to an edge in this graph.
Source§

impl<N, E> MutableGraph<N, E> for SimpleGraph<N, E>

Source§

fn new() -> Self

Creates a new empty graph.
Source§

fn add_node(&mut self, node: Node<N>) -> NodeId

Adds the given node to the graph. The return value is the id assigned to the new node.
Source§

fn add_edge(&mut self, edge: Edge<E>) -> Result<EdgeId, GraphModificationError>

Adds the given edge to the graph. The return value is the id assigned to the new edge, or an error, if the edge refers a non-existing node.

Auto Trait Implementations§

§

impl<N, E> Freeze for SimpleGraph<N, E>

§

impl<N, E> RefUnwindSafe for SimpleGraph<N, E>

§

impl<N, E> Send for SimpleGraph<N, E>
where N: Send, E: Send,

§

impl<N, E> Sync for SimpleGraph<N, E>
where N: Sync, E: Sync,

§

impl<N, E> Unpin for SimpleGraph<N, E>
where N: Unpin, E: Unpin,

§

impl<N, E> UnwindSafe for SimpleGraph<N, E>
where N: UnwindSafe, E: 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, 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.