MCPcopy Index your code
hub / github.com/marijnh/Eloquent-JavaScript / runLayout

Function runLayout

code/chapter/22_fast.js:76–91  ·  view source on GitHub ↗
(implementation, graph)

Source from the content-addressed store, hash-verified

74}
75
76async function runLayout(implementation, graph) {
77 let time = 0, iterations = 0;
78 let layout = randomLayout(graph);
79 while (time < 3000) {
80 let start = Date.now();
81 for (let i = 0; i < 100; i++) {
82 implementation(layout, graph);
83 iterations++;
84 }
85 time += Date.now() - start;
86 drawGraph(graph, layout);
87 await pause();
88 }
89 let perSecond = Math.round(iterations / (time / 1000));
90 console.log(`${perSecond} iterations per second`);
91}
92
93function forceDirected_noRepeat(layout, graph) {
94 for (let a = 0; a < graph.size; a++) {

Callers

nothing calls this directly

Calls 3

randomLayoutFunction · 0.85
drawGraphFunction · 0.85
pauseFunction · 0.85

Tested by

no test coverage detected