mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-01-13 16:17:54 +00:00
Docs: Update benchmark for google/gemini-3-flash-preview TEMP:0.35
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
async function findShortestPath(graph, start, end) {
|
||||
const PQ = (await import('https://esm.sh/js-priority-queue')).default;
|
||||
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 [m, weight] of Object.entries(graph[n] ?? {})) {
|
||||
const d = w + weight;
|
||||
if (d < (dists[m] ?? Infinity)) {
|
||||
dists[m] = d;
|
||||
pq.queue({ n: m, w: d });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Infinity;
|
||||
}
|
||||
export default findShortestPath;
|
||||
// Generation time: 20.870s
|
||||
// Result: PASS
|
||||
Reference in New Issue
Block a user