Random
Generate a random graph.
Open in a new window.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="../build/ogma.min.js"></script>
<style>
#graph-container { top: 0; bottom: 0; left: 0; right: 0; position: absolute; margin: 0; overflow: hidden; }
#load {
position: absolute;
top: 0;
left: 0;
padding: 5px;
color: #fff;
background: #141229;
font-size: 12px;
font-family: monospace;
}
</style>
</head>
<body>
<div id="graph-container"></div>
<span id="load">Loading...</span>
<script>
'use strict';
var ogma = new Ogma({
container: 'graph-container'
});
ogma.generate.random({
nodes: 100,
edges: 100
})
.then(function(graph) {
// callback
ogma.setGraph(graph);
document.getElementById('load').parentElement.removeChild(document.getElementById('load'));
ogma.view.locateGraph();
});
</script>
</body>
</html>