SmallGraph

Struct SmallGraph 

Source
pub struct SmallGraph<T> { /* private fields */ }

Implementations§

Source§

impl<T> SmallGraph<T>

Source

pub fn new() -> SmallGraph<T>

Create a new SmallGraph

Source

pub fn insert(&mut self, value: T) -> NodeHandle

Insert a value into graph

Source

pub fn connect_to(&mut self, parent: NodeHandle, child: NodeHandle)

Create a directed connection between parent and child

Source

pub fn neighbors(&self, node: NodeHandle) -> SmallVec<[NodeHandle; 8]>

Get nodes this node has an edge to

Source

pub fn nodes_with_neighbor(&self, node: NodeHandle) -> SmallVec<[NodeHandle; 8]>

Get nodes that have an edge that can reach node

Source

pub fn connect(&mut self, a: NodeHandle, b: NodeHandle)

Create a two way connection between two nodes

Source

pub fn disconnect_all(&mut self, n: NodeHandle)

Disconnect all connections a node has

Source

pub fn disconnect(&mut self, a: NodeHandle, b: NodeHandle)

Disconnect all connections between two nodes

Source

pub fn disconnect_from(&mut self, source: NodeHandle, destination: NodeHandle)

Disconnect edge connection between source and destination

Source

pub fn is_connected_to( &mut self, source: NodeHandle, destination: NodeHandle, ) -> bool

Determine if there is a connection connection between a source and destination node

Source

pub fn remove(&mut self, n: NodeHandle) -> Option<T>

Remove a node and it’s connections from graph

Source

pub fn node_count(&self) -> usize

Returns the count of nodes

Source

pub fn get(&self, n: NodeHandle) -> Option<&T>

Get the value of a node

Source

pub fn get_mut(&mut self, n: NodeHandle) -> Option<&mut T>

Get a mutable value of a node

Auto Trait Implementations§

§

impl<T> Freeze for SmallGraph<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for SmallGraph<T>
where T: RefUnwindSafe,

§

impl<T> Send for SmallGraph<T>
where T: Send,

§

impl<T> Sync for SmallGraph<T>
where T: Sync,

§

impl<T> Unpin for SmallGraph<T>
where T: Unpin,

§

impl<T> UnwindSafe for SmallGraph<T>

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.