Struct Graph

Source
pub struct Graph<'a, T> { /* private fields */ }

Implementations§

Source§

impl<'a, T> Graph<'a, T>

Source

pub fn new(arena_list: &'a mut ArenaList<T>) -> Self

Source

pub fn add_node(&mut self, name: &str, data: T) -> usize

Source

pub fn add_edge(&mut self, src_idx: usize, dst_idx: usize)

Source

pub fn add_node_and_edge( &mut self, src_name: &str, src_data: T, dst_name: &str, dst_data: T, )

Source

pub fn get_node_by_idx(&self, idx: usize) -> &Node<T>

Source

pub fn get_name_by_idx(&self, idx: usize) -> &String

Source

pub fn get_idx_by_name(&self, name: &str) -> Option<&usize>

Source

pub fn get_all_data(&self) -> Vec<&T>

Source

pub fn get_all_node_names(&self) -> Vec<&String>

Source

pub fn get_all_edges(&self) -> Vec<(usize, usize)>

Source

pub fn print_nodes(&self)

Source

pub fn print_edges(&self)

Source

pub fn del_node_by_idx(&mut self, idx: usize) -> bool

Source

pub fn del_edge_by_idx(&mut self, src_idx: usize, dst_idx: usize) -> bool

Source

pub fn del_node_by_name(&mut self, name: &str) -> bool

Source

pub fn del_edge_by_name(&mut self, src_name: &str, dst_name: &str) -> bool

Source

pub fn clear(&mut self)

Source§

impl<'a, T> Graph<'a, T>

Source

pub fn get_downstream( &self, batch_idx: Vec<usize>, max_level: usize, ) -> HashMap<usize, Vec<usize>>

Source

pub fn get_shortest( &self, src_idx: usize, dst_idx: usize, max_level: usize, ) -> Option<usize>

Source§

impl<'a, T: Serialize + DeserializeOwned + Clone + Debug> Graph<'a, T>

Source

pub fn save(&self, filename: &str)

Source

pub fn load(&mut self, filename: &str)

Auto Trait Implementations§

§

impl<'a, T> Freeze for Graph<'a, T>

§

impl<'a, T> RefUnwindSafe for Graph<'a, T>
where T: RefUnwindSafe,

§

impl<'a, T> Send for Graph<'a, T>
where T: Send,

§

impl<'a, T> Sync for Graph<'a, T>
where T: Sync,

§

impl<'a, T> Unpin for Graph<'a, T>

§

impl<'a, T> !UnwindSafe for Graph<'a, 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.