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