mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-03-17 03:11:01 +00:00
Docs: Update benchmark for openrouter/aurora-alpha
This commit is contained in:
26
tests/1_dijkstra/outputs/openrouter_aurora-alpha.js
Normal file
26
tests/1_dijkstra/outputs/openrouter_aurora-alpha.js
Normal file
@@ -0,0 +1,26 @@
|
||||
async function findShortestPath(g, s, t) {
|
||||
if (!(s in g) || !(t in g)) return Infinity;
|
||||
const { PriorityQueue } = await import('https://cdn.skypack.dev/js-priority-queue');
|
||||
const d = {}, v = new Set();
|
||||
for (const n in g) d[n] = Infinity;
|
||||
d[s] = 0;
|
||||
const q = new PriorityQueue({ comparator: (a, b) => a[0] - b[0] });
|
||||
q.queue([0, s]);
|
||||
while (q.length) {
|
||||
const [dist, u] = q.dequeue();
|
||||
if (v.has(u)) continue;
|
||||
if (u === t) return dist;
|
||||
v.add(u);
|
||||
for (const [nbr, w] of Object.entries(g[u])) {
|
||||
const nd = dist + w;
|
||||
if (nd < d[nbr]) {
|
||||
d[nbr] = nd;
|
||||
q.queue([nd, nbr]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return Infinity;
|
||||
}
|
||||
export default findShortestPath;
|
||||
// Generation time: 2.281s
|
||||
// Result: FAIL
|
||||
Reference in New Issue
Block a user