mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-03-17 03:11:01 +00:00
Docs: Update benchmark for anthropic/claude-sonnet-4.6
This commit is contained in:
31
tests/1_dijkstra/outputs/anthropic_claude-sonnet-4.6.js
Normal file
31
tests/1_dijkstra/outputs/anthropic_claude-sonnet-4.6.js
Normal file
@@ -0,0 +1,31 @@
|
||||
const findShortestPath = async (graph, start, end) => {
|
||||
const { default: PriorityQueue } = await import(
|
||||
"https://cdn.jsdelivr.net/npm/js-priority-queue@0.1.5/priority-queue.js"
|
||||
);
|
||||
|
||||
const pq = new PriorityQueue({ comparator: (a, b) => a[0] - b[0] });
|
||||
const dist = Object.fromEntries(Object.keys(graph).map((n) => [n, Infinity]));
|
||||
|
||||
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]) {
|
||||
dist[v] = nd;
|
||||
pq.queue([nd, v]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return dist[end];
|
||||
};
|
||||
export default findShortestPath;
|
||||
// Generation time: 4.396s
|
||||
// Result: FAIL
|
||||
Reference in New Issue
Block a user