mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-01-14 00:27:55 +00:00
Docs: Update benchmark for openrouter/sherlock-think-alpha
This commit is contained in:
22
tests/1_dijkstra/outputs/openrouter_sherlock-think-alpha.js
Normal file
22
tests/1_dijkstra/outputs/openrouter_sherlock-think-alpha.js
Normal file
@@ -0,0 +1,22 @@
|
||||
async function findShortestPath(graph,start,end){
|
||||
const{PriorityQueue}=await import('https://cdn.skypack.dev/js-priority-queue');
|
||||
const dist={};
|
||||
for(let n in graph)dist[n]=Infinity;
|
||||
dist[start]=0;
|
||||
const pq=new PriorityQueue({comparator:(a,b)=>a.d-b.d});
|
||||
pq.queue({node:start,d:0});
|
||||
while(!pq.isEmpty()){
|
||||
const{node,d}=pq.dequeue();
|
||||
if(d>dist[node])continue;
|
||||
if(node===end)return d;
|
||||
for(let nei in graph[node]){
|
||||
const alt=d+graph[node][nei];
|
||||
if(alt<dist[nei]){
|
||||
dist[nei]=alt;
|
||||
pq.queue({node:nei,d:alt});
|
||||
}
|
||||
}
|
||||
}
|
||||
return Infinity;
|
||||
}
|
||||
export default findShortestPath;
|
||||
Reference in New Issue
Block a user