verae-mcp-timestamping-server/site/assets/vendor/dijkstrajs.esm.js

7 lines
1.6 KiB
JavaScript

/**
* Bundled by jsDelivr using Rollup v4.62.2 and esbuild v0.28.1.
* Original file: /npm/dijkstrajs@1.0.3/dijkstra.js
*
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
*/
var c={exports:{}},m;function j(){return m||(m=1,(function(x){var u={single_source_shortest_paths:function(s,r,t){var e={},i={};i[r]=0;var n=u.PriorityQueue.make();n.push(r,0);for(var p,h,o,v,a,d,f,l,y;!n.empty();){p=n.pop(),h=p.value,v=p.cost,a=s[h]||{};for(o in a)a.hasOwnProperty(o)&&(d=a[o],f=v+d,l=i[o],y=typeof i[o]>"u",(y||l>f)&&(i[o]=f,n.push(o,f),e[o]=h))}if(typeof t<"u"&&typeof i[t]>"u"){var k=["Could not find a path from ",r," to ",t,"."].join("");throw new Error(k)}return e},extract_shortest_path_from_predecessor_list:function(s,r){for(var t=[],e=r;e;)t.push(e),s[e],e=s[e];return t.reverse(),t},find_path:function(s,r,t){var e=u.single_source_shortest_paths(s,r,t);return u.extract_shortest_path_from_predecessor_list(e,t)},PriorityQueue:{make:function(s){var r=u.PriorityQueue,t={},e;s=s||{};for(e in r)r.hasOwnProperty(e)&&(t[e]=r[e]);return t.queue=[],t.sorter=s.sorter||r.default_sorter,t},default_sorter:function(s,r){return s.cost-r.cost},push:function(s,r){var t={value:s,cost:r};this.queue.push(t),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};x.exports=u})(c)),c.exports}var _=j(),q=_.PriorityQueue,P=_.extract_shortest_path_from_predecessor_list,w=_.find_path,g=_.single_source_shortest_paths;export{q as PriorityQueue,_ as default,P as extract_shortest_path_from_predecessor_list,w as find_path,g as single_source_shortest_paths};