small changes
This commit is contained in:
parent
30a49b665e
commit
466bfcd102
@ -43,10 +43,10 @@ pub fn show(matrix: &Vec<Vec<usize>>) {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn read_csv() -> Vec<Vec<usize>> {
|
||||
pub fn read_csv(file_name: String) -> Vec<Vec<usize>> {
|
||||
let mut matrix: Vec<Vec<usize>> = vec![];
|
||||
let dir: String = String::from("/home/rene/projects/Java/graphprogram/csv/");
|
||||
let file_path: String = dir + &String::from("art-brck.csv");
|
||||
let file_path = dir + &file_name;
|
||||
let mut csv = ReaderBuilder::new()
|
||||
.has_headers(false)
|
||||
.delimiter(b';')
|
||||
|
@ -6,7 +6,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn graph() {
|
||||
let mut adjazenz_matrix: Vec<Vec<usize>> = read_csv();
|
||||
let mut adjazenz_matrix: Vec<Vec<usize>> = read_csv("art-brck.csv".to_owned());
|
||||
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);
|
||||
@ -46,7 +46,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn matrix() {
|
||||
let adjazenz_matrix: Vec<Vec<usize>> = read_csv();
|
||||
let adjazenz_matrix: Vec<Vec<usize>> = read_csv("art-brck.csv".to_owned());
|
||||
|
||||
assert_eq!(adjazenz_matrix, vec![
|
||||
vec![0, 0, 1, 1, 0],
|
||||
|
@ -1,12 +1,9 @@
|
||||
pub mod graph;
|
||||
|
||||
pub fn main() {
|
||||
output();
|
||||
}
|
||||
let file_name = String::from("50n.csv");
|
||||
|
||||
// This is just for the pupose of visualising the output
|
||||
fn output() {
|
||||
let mut adjazenz_matrix: Vec<Vec<usize>> = graph::matrix::read_csv();
|
||||
let mut adjazenz_matrix: Vec<Vec<usize>> = graph::matrix::read_csv(file_name);
|
||||
let distanz_matrix: Vec<Vec<usize>> = graph::calculate_distanz_matrix(&adjazenz_matrix);
|
||||
let weg_matrix: Vec<Vec<usize>> = graph::calculate_weg_matrix(&adjazenz_matrix);
|
||||
|
||||
|
Reference in New Issue
Block a user