I have brain damage

This commit is contained in:
jacekpoz 2024-06-22 18:41:06 +02:00
parent bea2ec20d7
commit 01a7a76f04
Signed by: poz
SSH key fingerprint: SHA256:JyLeVWE4bF3tDnFeUpUaJsPsNlJyBldDGV/dIKSLyN8

View file

@ -66,12 +66,22 @@ impl Graph {
pub fn new_rand(size: usize) -> Self { pub fn new_rand(size: usize) -> Self {
Self { Self {
size, size,
edges: (0..size).map(|u| edges: {
(0..size).map(|v| let mut edges = vec![vec![0.0; size]; size];
if u == v { 0.0 }
else { thread_rng().gen::<f64>() } for i in 0..size {
).collect::<Vec<_>>()) for j in 0..size {
.collect::<Vec<_>>(), if i == j { continue }
let w = thread_rng().gen::<f64>();
edges[i][j] = w;
edges[j][i] = w;
}
}
edges
}
} }
} }