Docs: Update benchmark for x-ai/grok-4.1-fast

This commit is contained in:
github-actions[bot]
2025-11-20 01:45:32 +00:00
parent ba05809576
commit 932fcdce31
12 changed files with 199 additions and 0 deletions

View File

@@ -0,0 +1,21 @@
async function findShortestPath(graph, start, end) {
const { PriorityQueue } = await import('https://cdn.skypack.dev/js-priority-queue');
const pq = new PriorityQueue({ comparator: (a, b) => a.d - b.d });
const dist = {};
dist[start] = 0;
pq.queue({ node: start, d: 0 });
while (!pq.isEmpty()) {
const { node, d } = pq.dequeue();
if (d > dist[node]) continue;
if (node === end) return d;
for (const [nei, w] of Object.entries(graph[node] || {})) {
const alt = d + w;
if (alt < (dist[nei] ?? Infinity)) {
dist[nei] = alt;
pq.queue({ node: nei, d: alt });
}
}
}
return Infinity;
}
export default findShortestPath;