HTML5拓扑图
<!DOCTYPE html>
<html>
<head>
<title>拓扑图</title>
<style>
canvas {
border: 1px solid #000;
}
</style>
</head>
<body>
<canvas id="topology" width="400" height="400"></canvas>
<script>
var canvas = document.getElementById("topology");
var ctx = canvas.getContext("2d");
// 绘制节点
ctx.fillStyle = "#fff";
ctx.strokeStyle = "#000";
ctx.beginPath();
ctx.arc(100, 100, 20, 0, 2*Math.PI);
ctx.stroke();
ctx.fill();
ctx.beginPath();
ctx.arc(300, 100, 20, 0, 2*Math.PI);
ctx.stroke();
ctx.fill();
ctx.beginPath();
ctx.arc(200, 200, 20, 0, 2*Math.PI);
ctx.stroke();
ctx.fill();
// 绘制连接线
ctx.beginPath();
ctx.moveTo(100, 100);
ctx.lineTo(200, 200);
ctx.stroke();
ctx.beginPath();
ctx.moveTo(300, 100);
ctx.lineTo(200, 200);
ctx.stroke();
</script>
</body>
</html>
效果如下: