Performance (Github)
It loads a large graph exported from the Gephi software. The dataset was extracted from Github.
Open in a new window.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link href='https://fonts.googleapis.com/css?family=Roboto:400,700' rel='stylesheet' type='text/css'>
<script src="../build/ogma.min.js"></script>
<style>
#graph-container { top: 0; bottom: 0; left: 0; right: 0; position: absolute; margin: 0; overflow: hidden; }
.info {
position: absolute;
color: #fff;
background: #141229;
font-size: 12px;
font-family: monospace;
padding: 5px;
}
.info.n { top: 0; left: 0; }
.info.e { top: 20px; left: 0; }
</style>
</head>
<body>
<div id="graph-container"></div>
<div id="n" class="info n">loading a large graph, it can take a few seconds...</div>
<div id="e" class="info e"></div>
<script>
'use strict';
var ogma = new Ogma({
container: 'graph-container'
});
ogma.setOptions({
detect: {
// disable the detection of edges and texts, making them impossible to hover or select.
// this improves performances for large graphs
edges: false,
nodeTexts: false,
edgeTexts: false
},
interactions: {
drag: {
enabled: false // disable node dragging
}
}
});
ogma.styles.addNodeRule({
text: {
font: 'Roboto',
size: 12
},
innerStroke: {
minVisibleSize: 5
}
});
ogma.parse.gexfFromUrl('files/github.gexf').then(function(graph) {
ogma.setGraph(graph);
ogma.view.locateGraph();
document.getElementById('n').textContent = 'nodes: ' + ogma.getNodes().size;
document.getElementById('e').textContent = 'edges: ' + ogma.getEdges().size;
});
</script>
</body>
</html>