mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-01-14 08:37:56 +00:00
Docs: Update benchmark results
This commit is contained in:
22
tests/1_dijkstra/outputs/x-ai_grok-4.js
Normal file
22
tests/1_dijkstra/outputs/x-ai_grok-4.js
Normal file
@@ -0,0 +1,22 @@
|
||||
async function findShortestPath(graph, start, end) {
|
||||
const PQ = (await import('https://unpkg.com/js-priority-queue@0.1.5')).default;
|
||||
const D = {};
|
||||
D[start] = 0;
|
||||
const q = new PQ({comparator: (a, b) => a.d - b.d});
|
||||
q.queue({n: start, d: 0});
|
||||
while (q.length) {
|
||||
let {n: u, d} = q.dequeue();
|
||||
if (d > D[u]) continue;
|
||||
for (let v in graph[u]) {
|
||||
let a = d + graph[u][v];
|
||||
if (a < (D[v] ?? Infinity)) {
|
||||
D[v] = a;
|
||||
q.queue({n: v, d: a});
|
||||
}
|
||||
}
|
||||
}
|
||||
return D[end] ?? Infinity;
|
||||
}
|
||||
export default findShortestPath;
|
||||
// Generation time: 82.003s
|
||||
// Result: FAIL
|
||||
Reference in New Issue
Block a user