From 5f4611d65e40eae3ca6191a15f68d69ea5a1c4cb Mon Sep 17 00:00:00 2001 From: Kirill Rogovoy Date: Tue, 20 Jul 2021 21:24:52 +0300 Subject: WIP --- app_expo/data/randomdata.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 app_expo/data/randomdata.js (limited to 'app_expo/data/randomdata.js') diff --git a/app_expo/data/randomdata.js b/app_expo/data/randomdata.js new file mode 100644 index 0000000..2162485 --- /dev/null +++ b/app_expo/data/randomdata.js @@ -0,0 +1,11 @@ +function genRandomTree(N = 300, reverse = false) { + return { + nodes: [...Array(N).keys()].map((i) => ({ id: i })), + links: [...Array(N).keys()] + .filter((id) => id) + .map((id) => ({ + [reverse ? 'target' : 'source']: id, + [reverse ? 'source' : 'target']: Math.round(Math.random() * (id - 1)), + })), + } +} -- cgit v1.2.3