優先度つきキューを使用したダイクストラ法をJavaScriptで実装した。 ■実装 /** * Vertex * @param int value */ var Vertex = function(value){ var self = this; self.value = value; self.state = 0; self.dist = Number.POSITIVE_INFINITY;// もしくは十分に大きい値とか self.neighbor = []; self.appendNeighbor = function(){ for(var i = 0; i < arguments.length; i++){ self.neighbor.push(arguments[i]); } } } // set up a graph var s = new Vertex(0); var v1 =