chat-gptにコーディングしてもらったダイクストラ 「クラスカルでパスファインダーを」ってリクエストしたら ダイクストラを勧められた クラスカルが作るのは経路でなくツリーなのだ 参考動画 <script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.5.0/p5.js"></script> <div id="p5canvas"></div> <script> class Graph { constructor() { this.vertices = []; } addVertex(x, y) { this.vertices.push({ x, y, edges: [] }); } addEdge(source, destination, weight) { if (this.vertices[source] && this.vertices[destination]) { this.vertices[source].edges.push({ target: destination, weight }); this.vertices[destination].edges.push({ target: source, weight }); ...