Gigagraph
This commit is contained in:
parent
3491eb28d5
commit
d07c660e2a
6 changed files with 24 additions and 50 deletions
|
|
@ -1,32 +0,0 @@
|
|||
use crate::formula::node::graph_builder::GraphBuilder;
|
||||
|
||||
mod graph_builder;
|
||||
mod graph_modifier;
|
||||
|
||||
pub struct Node {
|
||||
children: Vec<Node>,
|
||||
function: fn(Vec<f64>) -> f64,
|
||||
}
|
||||
|
||||
impl Node {
|
||||
pub fn empty() -> Self {
|
||||
Node {
|
||||
children: vec![],
|
||||
function: |_| 0f64,
|
||||
}
|
||||
}
|
||||
pub fn build() -> GraphBuilder {
|
||||
GraphBuilder
|
||||
}
|
||||
pub fn get_value(&self) -> f64 {
|
||||
if self.children.len() == 0 {
|
||||
return (self.function)(vec![0f64]);
|
||||
}
|
||||
let mut inputs: Vec<f64> = vec![];
|
||||
for node in &self.children {
|
||||
inputs.push(node.get_value());
|
||||
}
|
||||
|
||||
return (self.function)(inputs);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue