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 {
|
||||
Self {
|
||||
size,
|
||||
edges: (0..size).map(|u|
|
||||
(0..size).map(|v|
|
||||
if u == v { 0.0 }
|
||||
else { thread_rng().gen::<f64>() }
|
||||
).collect::<Vec<_>>())
|
||||
.collect::<Vec<_>>(),
|
||||
edges: {
|
||||
let mut edges = vec![vec![0.0; size]; size];
|
||||
|
||||
for i in 0..size {
|
||||
for j in 0..size {
|
||||
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