pub struct SmallGraph<T> { /* private fields */ }Implementations§
Source§impl<T> SmallGraph<T>
impl<T> SmallGraph<T>
Sourcepub fn new() -> SmallGraph<T>
pub fn new() -> SmallGraph<T>
Create a new SmallGraph
Sourcepub fn insert(&mut self, value: T) -> NodeHandle
pub fn insert(&mut self, value: T) -> NodeHandle
Insert a value into graph
Sourcepub fn connect_to(&mut self, parent: NodeHandle, child: NodeHandle)
pub fn connect_to(&mut self, parent: NodeHandle, child: NodeHandle)
Create a directed connection between parent and child
Sourcepub fn neighbors(&self, node: NodeHandle) -> SmallVec<[NodeHandle; 8]>
pub fn neighbors(&self, node: NodeHandle) -> SmallVec<[NodeHandle; 8]>
Get nodes this node has an edge to
Sourcepub fn nodes_with_neighbor(&self, node: NodeHandle) -> SmallVec<[NodeHandle; 8]>
pub fn nodes_with_neighbor(&self, node: NodeHandle) -> SmallVec<[NodeHandle; 8]>
Get nodes that have an edge that can reach node
Sourcepub fn connect(&mut self, a: NodeHandle, b: NodeHandle)
pub fn connect(&mut self, a: NodeHandle, b: NodeHandle)
Create a two way connection between two nodes
Sourcepub fn disconnect_all(&mut self, n: NodeHandle)
pub fn disconnect_all(&mut self, n: NodeHandle)
Disconnect all connections a node has
Sourcepub fn disconnect(&mut self, a: NodeHandle, b: NodeHandle)
pub fn disconnect(&mut self, a: NodeHandle, b: NodeHandle)
Disconnect all connections between two nodes
Sourcepub fn disconnect_from(&mut self, source: NodeHandle, destination: NodeHandle)
pub fn disconnect_from(&mut self, source: NodeHandle, destination: NodeHandle)
Disconnect edge connection between source and destination
Sourcepub fn is_connected_to(
&mut self,
source: NodeHandle,
destination: NodeHandle,
) -> bool
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
Sourcepub fn remove(&mut self, n: NodeHandle) -> Option<T>
pub fn remove(&mut self, n: NodeHandle) -> Option<T>
Remove a node and it’s connections from graph
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Returns the count of nodes
Sourcepub fn get(&self, n: NodeHandle) -> Option<&T>
pub fn get(&self, n: NodeHandle) -> Option<&T>
Get the value of a node
Sourcepub fn get_mut(&mut self, n: NodeHandle) -> Option<&mut T>
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>where
T: RefUnwindSafe + UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more