Postingan

Menampilkan postingan dengan label inequality

Algorithm Graph Triangle Inequality

Gambar
Algorithm Graph Triangle Inequality . Consider the following (complete) graph where the edge weights are simply the euclidean distances between the vertices (which clearly satisfies the triangle inequality) running prim's algorithm on this graph (starting with vertex 1) gives the following mst with the vertices labeled in order of removal from the priority queue (i.e. Note:this holds for any graph representing points in a metric space. Image result for triangle inequality theorem Triangle from www.pinterest.com If our nodes are points on the plane, h(v) = p (v x −t x)2 +(v y −t y)2 is a consistent heuristic. In preorder walk, two or more edges of full walk are replaced with a single edge. In above algorithm, we print preorder walk as output.