Function `get_adj_matrix()` is now specific to `CtbnNetwork` only

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

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

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

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

Loading…
Cancel
Save