Last active
October 2, 2018 17:26
-
-
Save kedar9444/4e1813aa0f2e73508cbfe9d18e3d0f6e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var R = require("ramda"); | |
var randrange = require("random-number-in-range"); | |
var count = 100; | |
var nodes = R.range(0, 100).map((_, x) => ({ "name": x, "group": Math.floor(x * 7 / count) })); | |
var links = R.range(0, Math.floor(count * 1.15)).map(function(_, x) | |
{ | |
var source = x % count; | |
var target = Math.floor(Math.log(1 + randrange(0, count)) / Math.log(1.3)); | |
var value = 10.0 / (1 + Math.abs(source - target)); | |
return { "source": source, "target": target, "value": value }; | |
}) | |
var d3Graph = require("@runkit/runkit/d3-graph/1.0.0"); | |
d3Graph(nodes, links) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment