-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtestLargeNetwork.html
49 lines (49 loc) · 1.46 KB
/
testLargeNetwork.html
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<script src="https://cdnjs.cloudflare.com/ajax/libs/cytoscape/3.2.16/cytoscape.min.js"></script>
<title>Large network</title>
<style>
#cy {
width: 1900px;
height: 900px;
display: block;
}
</style>
</head>
<body>
<p id="number"></p>
<div id="cy"></div>
</body>
<script>
let size = 500;
document.getElementById('number').textContent = size.toString() + " nodes";
var cy = cytoscape({
container: document.getElementById('cy')
});
for (let i = 0; i <= size; i++) {
cy.add({
group: "nodes",
data: {id : i},
});
}
for (var i = 0; i < size; i++) {
let randomSource = Math.floor(Math.random()*size + 1);
let randomTarget = Math.floor(Math.random()*size + 1);
cy.add({
group: "edges",
data: { source: randomSource, target: randomTarget}
})
}
let timeStart = performance.now();
console.log('start', timeStart);
cy.layout({
name: 'cose',
stop: function(){
let timePerf = performance.now() - timeStart;
console.log('time taken:', timePerf/1000);
}
}).run();
</script>
</html>