mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-09-18 20:05:44 +00:00
Docs: Update benchmark for google/gemini-3.8-flash EFF:high
This commit is contained in:
27
tests/1_dijkstra/outputs/google_gemini-3.8-flash EFF_high.js
Normal file
27
tests/1_dijkstra/outputs/google_gemini-3.8-flash EFF_high.js
Normal file
@@ -0,0 +1,27 @@
|
||||
export async function findShortestPath(graph, start, end) {
|
||||
const { default: PriorityQueue } = await import('https://esm.sh/js-priority-queue');
|
||||
|
||||
const dist = new Map([[start, 0]]);
|
||||
const pq = new PriorityQueue({ comparator: (a, b) => a[1] - b[1] });
|
||||
pq.queue([start, 0]);
|
||||
|
||||
while (pq.length) {
|
||||
const [node, cost] = pq.dequeue();
|
||||
|
||||
if (node === end) return cost;
|
||||
if (cost > (dist.get(node) ?? Infinity)) continue;
|
||||
|
||||
for (const [neighbor, weight] of Object.entries(graph[node] ?? {})) {
|
||||
const nextCost = cost + weight;
|
||||
if (nextCost < (dist.get(neighbor) ?? Infinity)) {
|
||||
dist.set(neighbor, nextCost);
|
||||
pq.queue([neighbor, nextCost]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Infinity;
|
||||
}
|
||||
export default findShortestPath;
|
||||
// Generation time: 16.431s
|
||||
// Result: PASS
|
||||
Reference in New Issue
Block a user