[][src]Struct auto_diff::collection::graph::Graph

pub struct Graph { /* fields omitted */ }

Implementations

impl Graph[src]

pub fn new() -> Graph[src]

Create a graph with defaults

pub fn list_data(&self) -> Vec<NetIndex>[src]

iterator over data node.

pub fn list_op(&self) -> Vec<NetIndex>[src]

iterator over op node.

pub fn list_as_input(&self, var: &NetIndex) -> Result<Vec<NetIndex>, &str>[src]

Return the list of ops that the given variable is the input.

pub fn list_as_output(&self, var: &NetIndex) -> Result<Vec<NetIndex>, &str>[src]

Return the list of ops that the given variable is the output.

pub fn list_input(&self, func: &NetIndex) -> Result<Vec<NetIndex>, &str>[src]

Return the list of input given the func.

pub fn list_output(&self, func: &NetIndex) -> Result<Vec<NetIndex>, &str>[src]

Return a list of data as the output of the op.

pub fn add_data(&mut self, id: &NetIndex) -> Result<NetIndex, &str>[src]

Add a data node.

let mut g = Graph::new();
let data1 = NetIndex::new(0,0);
let data2 = NetIndex::new(1,0);
g.add_data(&data1);
g.add_data(&data2);

pub fn del_data(&mut self, id: &NetIndex) -> Result<NetIndex, &str>[src]

Remove a data node, op node and downstream data/op node are removed.

pub fn add_op(&mut self, id: &NetIndex) -> Result<NetIndex, &str>[src]

Add a danglging op node.

pub fn del_op(&mut self, id: &NetIndex) -> Result<NetIndex, &str>[src]

Remvoe an op node, input data node and downstream data/op node are removed.

pub fn decouple_data_func(
    &mut self,
    var: &NetIndex,
    func: &NetIndex
) -> Result<(), ()>
[src]

Decouple input variable and op

pub fn decouple_func_data(
    &mut self,
    func: &NetIndex,
    var: &NetIndex
) -> Result<(), ()>
[src]

Decouple op and output variable

pub fn get_input_cache(&self) -> BTreeSet<NetIndex>[src]

list data node without upstream op node in a set.

pub fn get_output_cache(&self) -> BTreeSet<NetIndex>[src]

list data node without downstream op node in a set.

pub fn connect(
    &mut self,
    dti: &[NetIndex],
    dto: &[NetIndex],
    op: &NetIndex
) -> Result<NetIndex, &str>
[src]

Connect input data, output data and operation

pub fn walk<F>(
    &self,
    start_set: &[NetIndex],
    forward: bool,
    closure: F
) -> Result<(), BTreeSet<NetIndex>> where
    F: Fn(&[NetIndex], &[NetIndex], &NetIndex), 
[src]

Walk through the graph with a starting set of data nodes. Go through backwards if forward is false.

Auto Trait Implementations

impl RefUnwindSafe for Graph

impl Send for Graph

impl Sync for Graph

impl Unpin for Graph

impl UnwindSafe for Graph

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,