mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-01-14 08:37:56 +00:00
Docs: Update benchmark for openai/gpt-5.2 EFF:xhigh
This commit is contained in:
34
tests/1_dijkstra/outputs/openai_gpt-5.2 EFF_xhigh.js
Normal file
34
tests/1_dijkstra/outputs/openai_gpt-5.2 EFF_xhigh.js
Normal file
@@ -0,0 +1,34 @@
|
||||
let _pqP;
|
||||
const _loadPQ = () =>
|
||||
_pqP || (_pqP = import("https://esm.sh/js-priority-queue@0.1.5"));
|
||||
|
||||
async function findShortestPath(graph, start, end) {
|
||||
if (start === end) return 0;
|
||||
if (!graph) return Infinity;
|
||||
|
||||
const { default: PriorityQueue } = await _loadPQ();
|
||||
const dist = Object.create(null);
|
||||
const pq = new PriorityQueue({ comparator: (a, b) => a[0] - b[0] });
|
||||
|
||||
dist[start] = 0;
|
||||
pq.queue([0, start]);
|
||||
|
||||
while (pq.length) {
|
||||
const [d, u] = pq.dequeue();
|
||||
if (d !== dist[u]) continue;
|
||||
if (u === end) return d;
|
||||
|
||||
for (const [v, w] of Object.entries(graph[u] || {})) {
|
||||
const nd = d + +w;
|
||||
if (nd < (dist[v] ?? Infinity)) {
|
||||
dist[v] = nd;
|
||||
pq.queue([nd, v]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Infinity;
|
||||
}
|
||||
export default findShortestPath;
|
||||
// Generation time: 91.630s
|
||||
// Result: PASS
|
||||
Reference in New Issue
Block a user