2023-05-30 19:13:41 +02:00
|
|
|
pub mod graph;
|
|
|
|
|
2023-05-31 12:45:45 +02:00
|
|
|
pub fn main() {
|
2023-06-01 11:08:59 +02:00
|
|
|
let file_name = String::from("50n.csv");
|
2023-05-31 12:45:45 +02:00
|
|
|
|
2023-06-01 11:08:59 +02:00
|
|
|
let mut adjazenz_matrix: Vec<Vec<usize>> = graph::matrix::read_csv(file_name);
|
2023-05-31 14:49:55 +02:00
|
|
|
let distanz_matrix: Vec<Vec<usize>> = graph::calculate_distanz_matrix(&adjazenz_matrix);
|
|
|
|
let weg_matrix: Vec<Vec<usize>> = graph::calculate_weg_matrix(&adjazenz_matrix);
|
|
|
|
|
2023-05-31 18:29:13 +02:00
|
|
|
println!("adjazen matrix:");
|
2023-05-31 14:49:55 +02:00
|
|
|
graph::matrix::show(&adjazenz_matrix);
|
|
|
|
println!("\ndistanz matrix:");
|
|
|
|
graph::matrix::show(&distanz_matrix);
|
|
|
|
println!("\nweg matrix:");
|
|
|
|
graph::matrix::show(&weg_matrix);
|
|
|
|
|
|
|
|
let exzentrizitaeten = graph::calculate_exzentrizitaeten(&distanz_matrix);
|
|
|
|
let properties = graph::calculate_properties(&exzentrizitaeten);
|
|
|
|
|
2023-05-31 23:13:59 +02:00
|
|
|
if properties.3 {
|
|
|
|
println!("\nexzentrizitäten: {:?}", exzentrizitaeten);
|
|
|
|
println!("radius: {}\ndiameter: {}\ncentre: {:?}", properties.0, properties.1, properties.2);
|
|
|
|
} else {
|
|
|
|
println!("\nexzentrizitäten: not connected");
|
|
|
|
println!("radius/diameter/centre: not connected");
|
|
|
|
}
|
2023-05-31 14:49:55 +02:00
|
|
|
|
2023-05-31 23:13:59 +02:00
|
|
|
let components: Vec<Vec<usize>> = graph::find_components(&weg_matrix);
|
2023-05-31 14:49:55 +02:00
|
|
|
println!("components: {:?}", components);
|
2023-05-31 23:13:59 +02:00
|
|
|
println!("bridges: {:?}", graph::find_bridges(&mut adjazenz_matrix, &components));
|
|
|
|
println!("articulations: {:?}", graph::find_articulations(&adjazenz_matrix, &components));
|
2023-06-01 11:08:59 +02:00
|
|
|
}
|