Added `get_adj_matrix()`

pull/91/head
Meliurwen 2 years ago
parent e638a627bb
commit c4da4ceadd
Signed by: meliurwen
GPG Key ID: 818A8B35E9F1CE10
  1. 2
      reCTBN/src/process.rs
  2. 5
      reCTBN/src/process/ctbn.rs
  3. 5
      reCTBN/src/process/ctmp.rs

@ -5,6 +5,7 @@ pub mod ctmp;
use std::collections::BTreeSet;
use ndarray::Array2;
use thiserror::Error;
use crate::params;
@ -117,4 +118,5 @@ pub trait NetworkProcess: Sync {
///
/// * The **children set** of the selected node.
fn get_children_set(&self, node: usize) -> BTreeSet<usize>;
fn get_adj_matrix(&self) -> Option<Array2<u16>>;
}

@ -240,4 +240,9 @@ impl process::NetworkProcess for CtbnNetwork {
.filter_map(|(idx, x)| if x > &0 { Some(idx) } else { None })
.collect()
}
/// Get the Adjacency Matrix.
fn get_adj_matrix(&self) -> Option<Array2<u16>> {
self.adj_matrix.clone()
}
}

@ -1,5 +1,7 @@
use std::collections::BTreeSet;
use ndarray::Array2;
use crate::{
params::{Params, StateType},
process,
@ -111,4 +113,7 @@ impl NetworkProcess for CtmpProcess {
None => panic!("Uninitialized CtmpProcess"),
}
}
fn get_adj_matrix(&self) -> Option<Array2<u16>> {
unimplemented!("CtmpProcess has only one node")
}
}

Loading…
Cancel
Save