mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-06-07 20:12:13 +00:00
Docs: Update benchmark for google/gemini-3.5-flash
This commit is contained in:
28
tests/1_dijkstra/outputs/google_gemini-3.5-flash.js
Normal file
28
tests/1_dijkstra/outputs/google_gemini-3.5-flash.js
Normal file
@@ -0,0 +1,28 @@
|
||||
export async function findShortestPath(graph, start, end) {
|
||||
const { default: PriorityQueue } = await import('https://esm.sh/js-priority-queue@0.1.5');
|
||||
|
||||
const dists = { [start]: 0 };
|
||||
const pq = new PriorityQueue({ comparator: (a, b) => a.dist - b.dist });
|
||||
|
||||
pq.queue({ node: start, dist: 0 });
|
||||
|
||||
while (pq.length) {
|
||||
const { node, dist } = pq.dequeue();
|
||||
|
||||
if (node === end) return dist;
|
||||
if (dist > (dists[node] ?? Infinity)) continue;
|
||||
|
||||
for (const [neighbor, weight] of Object.entries(graph[node] ?? {})) {
|
||||
const nextDist = dist + weight;
|
||||
if (nextDist < (dists[neighbor] ?? Infinity)) {
|
||||
dists[neighbor] = nextDist;
|
||||
pq.queue({ node: neighbor, dist: nextDist });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Infinity;
|
||||
}
|
||||
export default findShortestPath;
|
||||
// Generation time: 11.455s
|
||||
// Result: PASS
|
||||
Reference in New Issue
Block a user