mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-01-14 00:27:55 +00:00
Docs: Update benchmark for google/gemini-3-flash-preview
This commit is contained in:
28
tests/1_dijkstra/outputs/google_gemini-3-flash-preview.js
Normal file
28
tests/1_dijkstra/outputs/google_gemini-3-flash-preview.js
Normal file
@@ -0,0 +1,28 @@
|
||||
export const findShortestPath = async (graph, start, end) => {
|
||||
const { default: PQ } = await import('https://cdn.skypack.dev/js-priority-queue');
|
||||
|
||||
const dists = { [start]: 0 };
|
||||
const pq = new PQ({ comparator: (a, b) => a.w - b.w });
|
||||
|
||||
pq.queue({ n: start, w: 0 });
|
||||
|
||||
while (pq.length) {
|
||||
const { n, w } = pq.dequeue();
|
||||
|
||||
if (n === end) return w;
|
||||
if (w > (dists[n] ?? Infinity)) continue;
|
||||
|
||||
for (const [neighbor, weight] of Object.entries(graph[n] ?? {})) {
|
||||
const total = w + weight;
|
||||
if (total < (dists[neighbor] ?? Infinity)) {
|
||||
dists[neighbor] = total;
|
||||
pq.queue({ n: neighbor, w: total });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Infinity;
|
||||
};
|
||||
export default findShortestPath;
|
||||
// Generation time: 12.594s
|
||||
// Result: PASS
|
||||
Reference in New Issue
Block a user