Gigagraph

This commit is contained in:
Rendo 2025-11-06 18:42:08 +05:00
commit d07c660e2a
6 changed files with 24 additions and 50 deletions

View file

@ -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);
}
}