MCPcopy Create free account
hub / github.com/H4kor/graph-force / new_node_vector

Function new_node_vector

src/graph.rs:27–36  ·  view source on GitHub ↗
(size: usize)

Source from the content-addressed store, hash-verified

25}
26
27pub fn new_node_vector(size: usize) -> NodeVector {
28 let mut nodes = Vec::with_capacity(size);
29 for _ in 0..size {
30 nodes.push(RwLock::new(Node {
31 x: rand::thread_rng().gen_range(-0.5..0.5),
32 y: rand::thread_rng().gen_range(-0.5..0.5),
33 }));
34 }
35 Arc::new(nodes)
36}
37
38pub fn add_edge(matrix: &mut EdgeMatrix, i: usize, j: usize) {
39 let mut edges = matrix.write().unwrap();

Calls

no outgoing calls