MCPcopy Create free account
hub / github.com/algorithm-visualizer/algorithm-visualizer / set

Method set

src/core/tracers/GraphTracer.js:27–41  ·  view source on GitHub ↗
(array2d = [])

Source from the content-addressed store, hash-verified

25 }
26
27 set(array2d = []) {
28 this.nodes = [];
29 this.edges = [];
30 for (let i = 0; i < array2d.length; i++) {
31 this.addNode(i);
32 for (let j = 0; j < array2d.length; j++) {
33 const value = array2d[i][j];
34 if (value) {
35 this.addEdge(i, j, this.isWeighted ? value : null);
36 }
37 }
38 }
39 this.layout();
40 super.set();
41 }
42
43 directed(isDirected = true) {
44 this.isDirected = isDirected;

Callers

nothing calls this directly

Calls 3

addNodeMethod · 0.95
addEdgeMethod · 0.95
layoutMethod · 0.95

Tested by

no test coverage detected