Graph

Struct Graph 

Source
pub struct Graph<N, E> { /* private fields */ }

Implementations§

Source§

impl<N: NodeTrait, E: EdgeTrait> Graph<N, E>

Source

pub fn new(nodes: Vec<N>, edges: Vec<E>) -> Self

Source

pub fn add_node(&mut self, node: N) -> bool

Source

pub fn remove_node(&mut self, key: u32)

Source

pub fn add_edge(&mut self, edge: E) -> bool

Source

pub fn remove_edge(&mut self, source: u32, target: u32)

Trait Implementations§

Source§

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

Source§

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

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

impl<N: NodeTrait, E: EdgeTrait> Display for Graph<N, E>

Source§

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

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

impl<N: NodeTrait, E: EdgeTrait> GraphViewTrait<N, E> for Graph<N, E>

Source§

fn is_empty(&self) -> bool

Source§

fn has_sequential_keys(&self) -> bool

Source§

fn get_node(&self, key: u32) -> &N

Source§

fn has_node(&self, key: u32) -> bool

Source§

fn get_edge(&self, source: u32, target: u32) -> &E

Source§

fn has_edge(&self, source: u32, target: u32) -> bool

Source§

fn get_nodes<'a>(&'a self) -> impl Iterator<Item = &'a N>
where N: 'a,

Source§

fn get_node_keys(&self) -> impl Iterator<Item = u32>

Source§

fn get_edges<'a>(&'a self) -> impl Iterator<Item = &'a E>
where E: 'a,

Source§

fn get_predecessors<'a>(&'a self, node_key: u32) -> impl Iterator<Item = &'a N>
where N: 'a,

Source§

fn get_predecessors_keys(&self, node_key: u32) -> impl Iterator<Item = u32>

Source§

fn get_successors<'a>(&'a self, node_key: u32) -> impl Iterator<Item = &'a N>
where N: 'a,

Source§

fn get_successors_keys(&self, node_key: u32) -> impl Iterator<Item = u32>

Source§

fn filter(&self, node_keys: &[u32]) -> impl GraphViewTrait<N, E>

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

impl<N, E> UnwindSafe for Graph<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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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.