pub struct LpaWbPlus {
pub row_labels: Vec<Option<u32>>,
pub column_labels: Vec<Option<u32>>,
pub modularity: f64,
}Expand description
Holds the result of the modularity computation (LPAwb+ algorithm).
§Fields
row_labels: Assigned module for each row node (red nodes).column_labels: Assigned module for each column node (blue nodes).modularity: The computed modularity score.
§Example
use oxygraph::modularity::{LpaWbPlus, lpa_wb_plus};
use ndarray::array;
let matrix = array![[1.0, 0.0], [0.0, 1.0]];
let result = lpa_wb_plus(&matrix, None);
println!("Modularity score: {}", result.modularity);Fields§
§row_labels: Vec<Option<u32>>§column_labels: Vec<Option<u32>>§modularity: f64Implementations§
Source§impl LpaWbPlus
impl LpaWbPlus
Sourcepub fn plot(
&mut self,
int_mat: InteractionMatrix,
) -> Option<BTreeMap<usize, Vec<(String, String)>>>
pub fn plot( &mut self, int_mat: InteractionMatrix, ) -> Option<BTreeMap<usize, Vec<(String, String)>>>
Plots the module assignments on an interaction matrix.
§Arguments
int_mat: AnInteractionMatrixfrom which this modularity was calculated.
§Returns
Optionally returns a map of modules to lists of species pairs (parasite x host).
§Example
use oxygraph::modularity::lpa_wb_plus;
use oxygraph::int_matrix::InteractionMatrix;
use ndarray::array;
let matrix = array![
[1.0, 0.0],
[0.0, 1.0]
];
let mut lpa_result = lpa_wb_plus(&matrix, None);
let int_mat = InteractionMatrix {
inner: matrix.clone(),
rownames: vec!["P1".into(), "P2".into()],
colnames: vec!["H1".into(), "H2".into()],
};
lpa_result.plot(int_mat);Trait Implementations§
Auto Trait Implementations§
impl Freeze for LpaWbPlus
impl RefUnwindSafe for LpaWbPlus
impl Send for LpaWbPlus
impl Sync for LpaWbPlus
impl Unpin for LpaWbPlus
impl UnwindSafe for LpaWbPlus
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more