Skip to main content

MapAdjacencyList

Struct MapAdjacencyList 

Source
pub struct MapAdjacencyList<NI, E, M>
where NI: NodeIndex, E: NodesIterable<Node = NI>, M: MapTrait<NI, E>,
{ /* private fields */ }

Implementations§

Source§

impl<NI, E, M> MapAdjacencyList<NI, E, M>
where NI: NodeIndex, E: NodesIterable<Node = NI>, M: MapTrait<NI, E>,

Source

pub fn new(nodes: M) -> Result<Self, GraphError<NI>>
where NI: Copy, Self: Graph<NI, Error = GraphError<NI>>,

Create new map adjacency list with validation

This function validates that all edge destinations exist in the node set. Returns an error if any edge references a non-existent node.

Source

pub fn new_unchecked(nodes: M) -> Self

Trait Implementations§

Source§

impl<NI, E, M> FromGraph<NI, GraphError<NI>> for MapAdjacencyList<NI, E, M>
where NI: NodeIndex, E: NodesIterable<Node = NI> + MutableNodes<NI> + Default, M: MapTrait<NI, E> + Default,

Source§

fn from_graph<G>(source_graph: &G) -> Result<Self, GraphError<NI>>
where G: Graph<NI>, GraphError<NI>: From<G::Error>,

Creates a new graph by copying data from the source graph Read more
Source§

impl<NI, E, M> Graph<NI> for MapAdjacencyList<NI, E, M>
where M: MapTrait<NI, E>, NI: NodeIndex + Eq + Hash + Copy, E: NodesIterable<Node = NI>,

Source§

fn contains_node(&self, node: NI) -> Result<bool, Self::Error>

Optimized O(1) contains_node for map adjacency list

Source§

fn outgoing_edges( &self, node: NI, ) -> Result<impl Iterator<Item = NI>, Self::Error>

Optimized O(out-degree) outgoing_edges for map adjacency list

Source§

type Error = GraphError<NI>

Source§

fn iter_nodes(&self) -> Result<impl Iterator<Item = NI>, Self::Error>

Return an iterator over all nodes in the graph
Source§

fn iter_edges(&self) -> Result<impl Iterator<Item = (NI, NI)>, Self::Error>

Return an iterator over all edges in the graph
Source§

fn incoming_edges( &self, node: NI, ) -> Result<impl Iterator<Item = NI>, Self::Error>

Return an iterator over all incoming edges for a node Read more
Source§

impl<NI, E, M> GraphWithMutableEdges<NI> for MapAdjacencyList<NI, E, M>
where NI: NodeIndex + Eq + Hash + Copy + PartialEq, E: NodesIterable<Node = NI> + MutableNodes<NI>, M: MapTrait<NI, E>,

Source§

fn add_edge(&mut self, source: NI, destination: NI) -> Result<(), Self::Error>

Add a new edge to the graph Read more
Source§

fn remove_edge( &mut self, source: NI, destination: NI, ) -> Result<(), Self::Error>

Remove an edge from the graph Read more
Source§

impl<NI, E, M> GraphWithMutableNodes<NI> for MapAdjacencyList<NI, E, M>
where NI: NodeIndex + Eq + Hash + Copy, E: NodesIterable<Node = NI> + Default, M: MapTrait<NI, E>,

Source§

fn add_node(&mut self, node: NI) -> Result<(), Self::Error>

Add a new node to the graph Read more
Source§

fn remove_node(&mut self, node: NI) -> Result<(), Self::Error>

Remove a node from the graph Read more

Auto Trait Implementations§

§

impl<NI, E, M> Freeze for MapAdjacencyList<NI, E, M>
where M: Freeze,

§

impl<NI, E, M> RefUnwindSafe for MapAdjacencyList<NI, E, M>

§

impl<NI, E, M> Send for MapAdjacencyList<NI, E, M>
where M: Send, E: Send,

§

impl<NI, E, M> Sync for MapAdjacencyList<NI, E, M>
where M: Sync, E: Sync,

§

impl<NI, E, M> Unpin for MapAdjacencyList<NI, E, M>
where M: Unpin, E: Unpin,

§

impl<NI, E, M> UnsafeUnpin for MapAdjacencyList<NI, E, M>
where M: UnsafeUnpin,

§

impl<NI, E, M> UnwindSafe for MapAdjacencyList<NI, E, M>
where M: 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.