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.

37 lines
1.3 KiB
Rust
Raw Normal View History

2023-06-01 12:25:40 +02:00
use crate::graph::{*, matrix::*};
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 14:51:57 +02:00
let file_name = "24n.csv";
2023-06-01 12:25:40 +02:00
let mut adjazenz_matrix: Vec<Vec<usize>> = read_csv(file_name);
//let mut adjazenz_matrix: Vec<Vec<usize>> = fill_with_random(100);
let distanz_matrix: Vec<Vec<usize>> = calculate_distanz_matrix(&adjazenz_matrix);
let weg_matrix: Vec<Vec<usize>> = 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-01 12:25:40 +02:00
let exzentrizitaeten = calculate_exzentrizitaeten(&distanz_matrix);
let properties = calculate_properties(&exzentrizitaeten);
2023-05-31 14:49:55 +02:00
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-06-01 12:25:40 +02:00
let components: Vec<Vec<usize>> = find_components(&weg_matrix);
2023-05-31 14:49:55 +02:00
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
}