looks nicer
This commit is contained in:
parent
57e89300ec
commit
5c5b482c17
18
src/lib.rs
18
src/lib.rs
@ -2,16 +2,16 @@ pub mod graph;
|
|||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use crate::graph::{self, matrix::*};
|
use crate::graph::{*, matrix::*};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn graph() {
|
fn graph() {
|
||||||
let mut adjazenz_matrix: Vec<Vec<usize>> = graph::matrix::read_csv();
|
let mut adjazenz_matrix: Vec<Vec<usize>> = read_csv();
|
||||||
let distanz_matrix: Vec<Vec<usize>> = graph::calculate_distanz_matrix(&adjazenz_matrix);
|
let distanz_matrix: Vec<Vec<usize>> = calculate_distanz_matrix(&adjazenz_matrix);
|
||||||
let weg_matrix: Vec<Vec<usize>> = graph::calculate_weg_matrix(&adjazenz_matrix);
|
let weg_matrix: Vec<Vec<usize>> = calculate_weg_matrix(&adjazenz_matrix);
|
||||||
let exzentrizitaeten = graph::calculate_exzentrizitaeten(&distanz_matrix);
|
let exzentrizitaeten: Vec<usize> = calculate_exzentrizitaeten(&distanz_matrix);
|
||||||
let properties = graph::calculate_properties(&exzentrizitaeten);
|
let properties = calculate_properties(&exzentrizitaeten);
|
||||||
let components = graph::find_components(&weg_matrix);
|
let components: Vec<Vec<usize>> = find_components(&weg_matrix);
|
||||||
|
|
||||||
assert_eq!(adjazenz_matrix, vec![
|
assert_eq!(adjazenz_matrix, vec![
|
||||||
vec![0, 0, 1, 1, 0],
|
vec![0, 0, 1, 1, 0],
|
||||||
@ -40,8 +40,8 @@ mod tests {
|
|||||||
assert_eq!(properties.2, vec![4]);
|
assert_eq!(properties.2, vec![4]);
|
||||||
assert_eq!(properties.3, true);
|
assert_eq!(properties.3, true);
|
||||||
assert_eq!(components, vec![vec![1, 2, 3, 4, 5]]);
|
assert_eq!(components, vec![vec![1, 2, 3, 4, 5]]);
|
||||||
assert_eq!(graph::find_bridges(&mut adjazenz_matrix, &components), vec![vec![4, 5]]);
|
assert_eq!(find_bridges(&mut adjazenz_matrix, &components), vec![vec![4, 5]]);
|
||||||
assert_eq!(graph::find_articulations(&adjazenz_matrix, &components), vec![4]);
|
assert_eq!(find_articulations(&adjazenz_matrix, &components), vec![4]);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
Reference in New Issue
Block a user