mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-01-14 00:27:55 +00:00
Docs: Update benchmark results
This commit is contained in:
19
tests/1_dijkstra/outputs/openai_gpt-5.1-codex.js
Normal file
19
tests/1_dijkstra/outputs/openai_gpt-5.1-codex.js
Normal file
@@ -0,0 +1,19 @@
|
||||
async function findShortestPath(g,s,e){
|
||||
const {default:Q}=await import('https://cdn.skypack.dev/js-priority-queue')
|
||||
const d={[s]:0},q=new Q({comparator:(a,b)=>a.w-b.w})
|
||||
q.queue({n:s,w:0})
|
||||
while(q.length){
|
||||
const {n,w}=q.dequeue()
|
||||
if(w>(d[n]??Infinity))continue
|
||||
if(n===e)return w
|
||||
for(const k in g[n]||{}){
|
||||
const nw=w+g[n][k]
|
||||
if(nw<(d[k]??Infinity)){
|
||||
d[k]=nw
|
||||
q.queue({n:k,w:nw})
|
||||
}
|
||||
}
|
||||
}
|
||||
return Infinity
|
||||
}
|
||||
export default findShortestPath;
|
||||
Reference in New Issue
Block a user