Struct GraphBuilder

Source
pub struct GraphBuilder<W: Debug + Default + Clone, N: Debug + Default + Clone> { /* private fields */ }

Implementations§

Source§

impl<W: Debug + Default + Clone + AddAssign<W>, N: Debug + Default + Clone> GraphBuilder<W, N>

Source

pub fn new() -> GraphBuilder<W, N>

Source

pub fn save(&mut self)

Saves the current state to the internal state stack.

Source

pub fn restore(&mut self) -> bool

Restore a previously saved state. Returns false, if no saved state exists on the stack.

Source

pub fn count_nodes(&self) -> usize

Source

pub fn visit_nodes<F: FnMut(usize, &N)>(&self, callback: F)

Source

pub fn visit_edges<F: FnMut((usize, usize), &W)>(&self, callback: F)

Source

pub fn to_edge_list(&self) -> Vec<Option<(N, Vec<(usize, W)>)>>

Source

pub fn apply_operation<NT: NthEdge>(&mut self, op: EdgeOperation<W, N, NT>)
where W: Neg<Output = W>,

Source

pub fn update_edge_weight(&mut self, weight: W)

decrease-weight or increase-weight, depending on the sign of the weight. Updates the weight of the current edge, or in case of a virtual edge, creates a new edge with that weight.

Source

pub fn add_self_loop(&mut self, weight: W)

Adds a loop to the current edge’s target neuron.

Source

pub fn next<NT: NthEdge>(&mut self, n: NT)

Change from-node of current link to it’s n-th sibling. The n-th sibling is the current+n-th incoming node into the to-node.

Source

pub fn parent<NT: NthEdge>(&mut self, n: NT)

Change from-node of current link to n-th input edge of current from node. If no input edge exists, the edge is left as is. TODO: Test case The n-th input node is not deleted. NOTE: Does not modify the graph itself, only changes the current link.

Trait Implementations§

Source§

impl<W: Debug + Debug + Default + Clone, N: Debug + Debug + Default + Clone> Debug for GraphBuilder<W, N>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<W, N> Freeze for GraphBuilder<W, N>

§

impl<W, N> RefUnwindSafe for GraphBuilder<W, N>

§

impl<W, N> Send for GraphBuilder<W, N>
where W: Send, N: Send,

§

impl<W, N> Sync for GraphBuilder<W, N>
where W: Sync, N: Sync,

§

impl<W, N> Unpin for GraphBuilder<W, N>
where N: Unpin,

§

impl<W, N> UnwindSafe for GraphBuilder<W, N>

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.