-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
26 lines (20 loc) · 704 Bytes
/
index.js
File metadata and controls
26 lines (20 loc) · 704 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
const fs = require("fs");
const NODE_COUNT = 100000;
const nodes = Array.from({ length: NODE_COUNT }, (_, i) => ({
id: `n${i}`,
label: `Node ${i}`,
x: Math.random() * 1000,
y: Math.random() * 1000,
size: Math.random() * 5 + 1,
color: `#${Math.floor(Math.random() * 16777215).toString(16)}`,
}));
const EDGE_COUNT = NODE_COUNT * 2;
const edges = Array.from({ length: EDGE_COUNT }, (_, i) => ({
id: `e${i}`,
source: `n${Math.floor(Math.random() * NODE_COUNT)}`,
target: `n${Math.floor(Math.random() * NODE_COUNT)}`,
color: "#ccc",
}));
const graphData = { nodes, edges };
fs.writeFileSync("graph.json", JSON.stringify(graphData));
console.log("Graph data generated: graph.json");