mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-03-17 03:11:01 +00:00
Docs: Update benchmark for z-ai/glm-5
This commit is contained in:
24
tests/1_dijkstra/outputs/z-ai_glm-5.js
Normal file
24
tests/1_dijkstra/outputs/z-ai_glm-5.js
Normal file
@@ -0,0 +1,24 @@
|
||||
async function findShortestPath(graph, start, end) {
|
||||
const { default: PQ } = await import('https://cdn.skypack.dev/js-priority-queue');
|
||||
const dist = { [start]: 0 };
|
||||
const pq = new PQ({ comparator: (a, b) => a.w - b.w });
|
||||
pq.queue({ v: start, w: 0 });
|
||||
|
||||
while (pq.length) {
|
||||
const { v, w } = pq.dequeue();
|
||||
if (v === end) return w;
|
||||
if (w > (dist[v] ?? Infinity)) continue;
|
||||
|
||||
for (const n in graph[v]) {
|
||||
const d = w + graph[v][n];
|
||||
if (d < (dist[n] ?? Infinity)) {
|
||||
dist[n] = d;
|
||||
pq.queue({ v: n, w: d });
|
||||
}
|
||||
}
|
||||
}
|
||||
return Infinity;
|
||||
}
|
||||
export default findShortestPath;
|
||||
// Generation time: 31.439s
|
||||
// Result: PASS
|
||||
Reference in New Issue
Block a user