[][src]Struct graphs::simple_graph::SimpleGraph

pub struct SimpleGraph<N, E> { /* fields omitted */ }

A simple directed graph implementation.

  • Nodes are represented with Vec<N>

  • Edges are represented with Vec<Vec<Option<E>>>

  • All IDs are opaque data structures

Please see the trait implementations for more details

Implementations

impl<N, E> SimpleGraph<N, E>[src]

pub fn new() -> Self[src]

Trait Implementations

impl<N: Clone, E: Clone> Clone for SimpleGraph<N, E>[src]

impl<N: Debug, E: Debug> Debug for SimpleGraph<N, E>[src]

impl<N, E> GraphBase for SimpleGraph<N, E>[src]

type NodeID = NodeID

type EdgeID = EdgeID

impl<N, E> GraphEdgeAddable<E> for SimpleGraph<N, E> where
    E: Clone
[src]

pub fn add_edge(
    &mut self,
    a: Self::NodeID,
    b: Self::NodeID,
    data: E
) -> Self::EdgeID
[src]

Data added from node A to B will overwrite the data that was previously between those edges

impl<N, E> GraphEdgeEndpoints for SimpleGraph<N, E>[src]

impl<N, E> GraphEdgeFrom for SimpleGraph<N, E>[src]

pub fn edge_from(&self, EdgeID((id_a, _)): Self::EdgeID) -> Self::NodeID[src]

Find the source of an edge

impl<N, E> GraphEdgeIndexable<E> for SimpleGraph<N, E>[src]

pub fn edge(&self, EdgeID((id_a, id_b)): Self::EdgeID) -> &E[src]

Get the data associated with an edge

Panics if the edge is not in the graph

impl<N, E> GraphEdgeMutIndexable<E> for SimpleGraph<N, E>[src]

pub fn edge_mut(&mut self, EdgeID((id_a, id_b)): Self::EdgeID) -> &mut E[src]

Get the data associated with an edge

Panics if the edge is not in the graph

impl<N, E> GraphEdgeRemovable<E> for SimpleGraph<N, E>[src]

pub fn remove_edge(&mut self, EdgeID((id_a, id_b)): Self::EdgeID) -> E[src]

Panics if the node is not in the graph

impl<N, E> GraphEdgeTo for SimpleGraph<N, E>[src]

pub fn edge_to(&self, EdgeID((_, id_b)): Self::EdgeID) -> Self::NodeID[src]

Find the destination of an edge

impl<N, E> GraphEdgesFrom for SimpleGraph<N, E>[src]

type EdgesFromOutput = Vec<EdgeID>

pub fn edges_from(&self, NodeID(id): Self::NodeID) -> Self::EdgesFromOutput[src]

Find all edges from a node

Return result in a Vec

impl<N, E> GraphNodeAddable<N> for SimpleGraph<N, E>[src]

pub fn add_node(&mut self, data: N) -> Self::NodeID[src]

Identical data added twice will return different node IDs

impl<N, E> GraphNodeIndexable<N> for SimpleGraph<N, E>[src]

pub fn node(&self, NodeID(id): Self::NodeID) -> &N[src]

Get the data associated with a node

Panics if the node is not in the graph

impl<N, E> GraphNodeMutIndexable<N> for SimpleGraph<N, E>[src]

pub fn node_mut(&mut self, NodeID(id): Self::NodeID) -> &mut N[src]

Get the data associated with a node

Panics if the node is not in the graph

impl<N, E> GraphNodeRemovable<N> for SimpleGraph<N, E>[src]

pub fn remove_node(&mut self, NodeID(id): Self::NodeID) -> N[src]

Panics if the node is not in the graph

Panics if any edges lead into or out of that edge

Auto Trait Implementations

impl<N, E> RefUnwindSafe for SimpleGraph<N, E> where
    E: RefUnwindSafe,
    N: RefUnwindSafe
[src]

impl<N, E> Send for SimpleGraph<N, E> where
    E: Send,
    N: Send
[src]

impl<N, E> Sync for SimpleGraph<N, E> where
    E: Sync,
    N: Sync
[src]

impl<N, E> Unpin for SimpleGraph<N, E> where
    E: Unpin,
    N: Unpin
[src]

impl<N, E> UnwindSafe for SimpleGraph<N, E> where
    E: UnwindSafe,
    N: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.