Skip to content

Commit 812b3a4

Browse files
Update generation of random topologies
1 parent ab7d165 commit 812b3a4

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

nebula/frontend/templates/deployment.html

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2420,6 +2420,25 @@ <h5 class="step-title">Schema of deployment</h5>
24202420
document.getElementById("predefined-topology-select").addEventListener("change", function (){
24212421
updateNodes();
24222422
});
2423+
2424+
function generateRandomLinks(nodes, probability) {
2425+
const links = [];
2426+
for (let i = 0; i < nodes.length; i++) {
2427+
for (let j = i + 1; j < nodes.length; j++) {
2428+
if (Math.random() < probability) {
2429+
links.push({ source: i, target: j });
2430+
}
2431+
}
2432+
}
2433+
return links;
2434+
}
2435+
2436+
// Add event listener for probability changes
2437+
document.getElementById("random-probability").addEventListener("change", function() {
2438+
if ($("#predefined-topology-select").val() === 'Random') {
2439+
updateNodes();
2440+
}
2441+
});
24232442
</script>
24242443

24252444
<script>

0 commit comments

Comments
 (0)