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-05 16:07:36 +02:00
|
|
|
let file_name = "24n.csv";
|
|
|
|
let adjazenz_matrix = read_csv(file_name);
|
|
|
|
//let adjazenz_matrix = fill_with_random(320); // with 320 verteces, it runs in about 10 seconds on an Intel i5-10300H @4.3 GHz (2023-06-05 15:48)
|
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-06-05 16:07:36 +02:00
|
|
|
println!("adjazenz 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
|
|
|
|
2023-06-05 16:07:36 +02:00
|
|
|
println!("bridges: {:?}", find_bridges(&adjazenz_matrix));
|
|
|
|
println!("articulations: {:?}", find_articulations(&adjazenz_matrix));
|
2023-06-01 11:08:59 +02:00
|
|
|
}
|