Created
January 14, 2016 05:24
-
-
Save kuza55/4b2cfd57b33d4234d4ef 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 url = "../visualizations" | |
nodeCount = 700; | |
var nodes = []; | |
var groups = []; | |
var labels = []; | |
for (i=0;i<nodeCount;i++) { | |
nodes.push(i); | |
// groups.push(1); | |
// labels.push("Hi"); | |
} | |
var edges = []; | |
var edgeSet = {}; | |
for (i=0;i<nodeCount*2;i++) { | |
var x = Math.round(Math.random()*(nodeCount-1)); | |
var y = Math.round(Math.random()*(nodeCount-1)); | |
var key = x+"|"+y; | |
if (!(key in edgeSet)) { | |
edges.push([x,y,1]); | |
edgeSet[key] = 1; | |
} | |
} | |
var data = { | |
nodes: nodes, | |
links: edges, | |
}; | |
//JSON.stringify(data); | |
$.ajax({ | |
type:"POST", | |
url: url, | |
contentType: "application/json", | |
data: JSON.stringify({ | |
type:"force", | |
data:data | |
}) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment