mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-06-28 04:12:13 +00:00
Docs: Update benchmark for anthropic/claude-fable-5
This commit is contained in:
24
tests/1_dijkstra/outputs/anthropic_claude-fable-5.js
Normal file
24
tests/1_dijkstra/outputs/anthropic_claude-fable-5.js
Normal file
@@ -0,0 +1,24 @@
|
||||
const findShortestPath = async (graph, start, end) => {
|
||||
const { default: PriorityQueue } = await import(
|
||||
'https://cdn.jsdelivr.net/npm/js-priority-queue@0.1.5/+esm'
|
||||
);
|
||||
const dist = { [start]: 0 };
|
||||
const pq = new PriorityQueue({ comparator: (a, b) => a[0] - b[0] });
|
||||
pq.queue([0, start]);
|
||||
while (pq.length) {
|
||||
const [d, node] = pq.dequeue();
|
||||
if (node === end) return d;
|
||||
if (d > (dist[node] ?? Infinity)) continue;
|
||||
for (const [next, w] of Object.entries(graph[node] ?? {})) {
|
||||
const nd = d + w;
|
||||
if (nd < (dist[next] ?? Infinity)) {
|
||||
dist[next] = nd;
|
||||
pq.queue([nd, next]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return Infinity;
|
||||
};
|
||||
export default findShortestPath;
|
||||
// Generation time: 12.985s
|
||||
// Result: PASS
|
||||
Reference in New Issue
Block a user