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