Skip to content

Instantly share code, notes, and snippets.

@vasturiano
Last active January 31, 2024 10:29
Show Gist options
  • Select an option

  • Save vasturiano/2e655fdd1f378cb2002435fe33d7d6ec to your computer and use it in GitHub Desktop.

Select an option

Save vasturiano/2e655fdd1f378cb2002435fe33d7d6ec to your computer and use it in GitHub Desktop.
3D Internet Topology

3D force-simulated version of Internet Interactive Map, showing AS relationships for approximately 3k ASes in the Internet core. ASes have a volume proportional to the size of their customer cone and are color-coded by continent. Rendered using 3d-force-graph.

<head>
<script src="//unpkg.com/3d-force-graph@1"></script>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div id="3d-graph"></div>
<button class="full-btn" onClick="useFull()">Full</button>
<script src="index.js"></script>
</body>
const Graph = ForceGraph3D()
.nodeId('asn')
.nodeVal('customerConeSize')
.linkSource('src')
.linkTarget('dst')
.nodeAutoColorBy('country')
.warmupTicks(200)
.cooldownTicks(0) // Don't animate-in, jump to final state
.nodeRelSize(1)
.linkOpacity(0.07)
.forceEngine('ngraph')
(document.getElementById("3d-graph"));
loadData('internet-topology-subset.json'); // Init
//
function useFull() {
Graph.linkOpacity(0.03)
.nodeResolution(3);
loadData('internet-topology-full.json');
}
function loadData(url) {
fetch(url).then(r => r.json()).then(data => {
data.ases.forEach(as => { as.name = `AS${as.asn} - ${as.orgName} (${as.country})` }); // Add label
Graph.graphData({
nodes: data.ases,
links: data.relationships
});
});
}
This file has been truncated, but you can view the full file.
View raw

(Sorry about that, but we can’t show files that are this big right now.)

View raw

(Sorry about that, but we can’t show files that are this big right now.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment