A new, blazing-fast learning engine for Continuous Time Bayesian Networks. Written in pure Rust. 🦀
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
reCTBN/src/network.rs

19 lines
853 B

use petgraph::prelude::*; use crate::node;
3 years ago
use thiserror::Error;
use crate::params;
3 years ago
#[derive(Error, Debug)]
pub enum NetworkError {
#[error("Error during node insertion")]
3 years ago
NodeInsertionError(String)
3 years ago
}
pub trait Network {
fn add_node(&mut self, n: node::Node) -> Result<petgraph::graph::NodeIndex, NetworkError>;
3 years ago
fn add_edge(&mut self, parent: &petgraph::stable_graph::NodeIndex, child: &petgraph::graph::NodeIndex);
fn get_node_indices(&self) -> petgraph::stable_graph::NodeIndices<node::Node>;
fn get_node(&self, node_idx: &petgraph::stable_graph::NodeIndex) -> &node::Node;
3 years ago
fn get_param_index_parents(&self, node: &petgraph::stable_graph::NodeIndex, u: &Vec<params::StateType>) -> usize;
fn get_param_index_network(&self, node: &petgraph::stable_graph::NodeIndex, current_state: &Vec<params::StateType>) -> usize;
3 years ago
}