mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-06-07 20:12:13 +00:00
Docs: Update benchmark for anthropic/claude-opus-4.8 EFF:medium
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
async function findShortestPath(graph, start, end) {
|
||||
const { default: PriorityQueue } = await import("https://esm.sh/js-priority-queue");
|
||||
const dist = {};
|
||||
for (const node in graph) dist[node] = Infinity;
|
||||
dist[start] = 0;
|
||||
const pq = new PriorityQueue({ comparator: (a, b) => a.cost - b.cost });
|
||||
pq.queue({ node: start, cost: 0 });
|
||||
while (pq.length) {
|
||||
const { node, cost } = pq.dequeue();
|
||||
if (node === end) return cost;
|
||||
if (cost > dist[node]) continue;
|
||||
for (const next in graph[node]) {
|
||||
const nc = cost + graph[node][next];
|
||||
if (nc < dist[next]) {
|
||||
dist[next] = nc;
|
||||
pq.queue({ node: next, cost: nc });
|
||||
}
|
||||
}
|
||||
}
|
||||
return dist[end] ?? Infinity;
|
||||
}
|
||||
export default findShortestPath;
|
||||
// Generation time: 5.506s
|
||||
// Result: PASS
|
||||
Reference in New Issue
Block a user