I have brain damage
This commit is contained in:
parent
bea2ec20d7
commit
01a7a76f04
1 changed files with 16 additions and 6 deletions
|
@ -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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue