This repository has been archived on 2024-10-09. You can view files and clone it, but cannot push or open issues or pull requests.

44 lines
1.4 KiB
Rust
Raw Normal View History

2023-06-03 12:36:34 +02:00
#[allow(unused_imports)]
use crate::graph::{
matrix::{fill_with_random, read_csv, show},
*,
};
2023-06-01 12:25:40 +02:00
2023-05-30 19:13:41 +02:00
pub mod graph;
2023-05-31 12:45:45 +02:00
pub fn main() {
2023-06-03 12:36:34 +02:00
//let file_name = "50n.csv";
//let mut adjazenz_matrix = read_csv(file_name);
let mut adjazenz_matrix = fill_with_random(1); // with 48 verteces, it runs in about 10.2 seconds (run on the 2023-06-03 at 12:36)
2023-06-03 10:12:59 +02:00
let distanz_matrix = calculate_distanz_matrix(&adjazenz_matrix);
let weg_matrix = calculate_weg_matrix(&adjazenz_matrix);
2023-05-31 14:49:55 +02:00
2023-05-31 18:29:13 +02:00
println!("adjazen matrix:");
2023-06-01 12:25:40 +02:00
show(&adjazenz_matrix);
2023-05-31 14:49:55 +02:00
println!("\ndistanz matrix:");
2023-06-01 12:25:40 +02:00
show(&distanz_matrix);
2023-05-31 14:49:55 +02:00
println!("\nweg matrix:");
2023-06-01 12:25:40 +02:00
show(&weg_matrix);
2023-05-31 14:49:55 +02:00
2023-06-02 14:59:36 +02:00
let exzentrizitaeten = calculate_exzentrizitaeten(distanz_matrix);
2023-06-01 12:25:40 +02:00
let properties = calculate_properties(&exzentrizitaeten);
2023-05-31 14:49:55 +02:00
2023-05-31 23:13:59 +02:00
if properties.3 {
2023-06-03 10:12:59 +02:00
println!("\nexzentrizitäten: {exzentrizitaeten:?}");
println!(
"radius: {}\ndiameter: {}\ncentre: {:?}",
properties.0, properties.1, properties.2
);
2023-05-31 23:13:59 +02:00
} else {
println!("\nexzentrizitäten: not connected");
println!("radius/diameter/centre: not connected");
}
2023-05-31 14:49:55 +02:00
2023-06-03 10:12:59 +02:00
let components = find_components(weg_matrix);
println!("components: {components:?}");
2023-06-01 12:25:40 +02:00
let result = find_articulations_and_bridges(&mut adjazenz_matrix, &components);
println!("bridges: {:?}", result.1);
println!("articulations: {:?}", result.0);
2023-06-01 11:08:59 +02:00
}