Docs: Update Gemini benchmark results

This commit is contained in:
github-actions[bot]
2025-11-18 22:04:41 +00:00
parent 31a18dd4ee
commit 33b8150958
220 changed files with 3259 additions and 1494 deletions

View File

@@ -1,22 +1,22 @@
const findShortestPath = async (g, s, e) => {
const { default: Q } = await import('https://esm.sh/js-priority-queue')
const q = new Q({ comparator: (a, b) => a.w - b.w })
const { default: PQ } = await import('https://esm.sh/js-priority-queue')
const q = new PQ({ comparator: (a, b) => a.w - b.w })
const d = { [s]: 0 }
q.queue({ n: s, w: 0 })
while (q.length) {
const { n, w } = q.dequeue()
if (n === e) return w
if (w > (d[n] ?? 1/0)) continue
if (w > (d[n] ?? Infinity)) continue
for (let v in g[n]) {
let t = w + g[n][v]
if (t < (d[v] ?? 1/0)) {
d[v] = t
q.queue({ n: v, w: t })
let k = w + g[n][v]
if (k < (d[v] ?? Infinity)) {
d[v] = k
q.queue({ n: v, w: k })
}
}
}
return 1/0
return Infinity
}
export default findShortestPath;

View File

@@ -1,19 +1,21 @@
const findShortestPath = async (g, s, e) => {
const { default: P } = await import('https://esm.sh/js-priority-queue');
const q = new P({ comparator: (a, b) => a.w - b.w }), d = { [s]: 0 };
q.queue({ n: s, w: 0 });
const { default: Q } = await import('https://esm.sh/js-priority-queue')
const d = { [s]: 0 }, q = new Q({ comparator: (a, b) => a[1] - b[1] })
q.queue([s, 0])
while (q.length) {
const { n, w } = q.dequeue();
if (n === e) return w;
if (w > (d[n] ?? 1 / 0)) continue;
for (const k in g[n] || {}) {
const t = w + g[n][k];
if (t < (d[k] ?? 1 / 0)) {
d[k] = t;
q.queue({ n: k, w: t });
const [u, w] = q.dequeue()
if (u === e) return w
if (w > (d[u] ?? 1/0)) continue
for (let v in g[u]) {
const k = w + g[u][v]
if (k < (d[v] ?? 1/0)) {
d[v] = k
q.queue([v, k])
}
}
}
return 1 / 0;
};
return 1/0
}
export default findShortestPath;

View File

@@ -1,20 +1,25 @@
const findShortestPath = async (g, s, e) => {
const { default: P } = await import('https://esm.sh/js-priority-queue')
const q = new P({ comparator: (a, b) => a.w - b.w })
const m = { [s]: 0 }
q.queue({ n: s, w: 0 })
while (q.length) {
const { n, w } = q.dequeue()
if (n === e) return w
if (w > (m[n] ?? 1 / 0)) continue
for (const k in g[n] || {}) {
const t = w + g[n][k]
if (t < (m[k] ?? 1 / 0)) {
m[k] = t
q.queue({ n: k, w: t })
}
const { default: P } = await import('https://cdn.jsdelivr.net/npm/js-priority-queue@0.1.5/+esm');
const q = new P({ comparator: (a, b) => a.w - b.w });
const d = { [s]: 0 };
q.queue({ n: s, w: 0 });
while (q.length) {
const { n, w } = q.dequeue();
if (n === e) return w;
if (w > (d[n] ?? 1/0)) continue;
for (let v in g[n]) {
let k = w + g[n][v];
if (k < (d[v] ?? 1/0)) {
d[v] = k;
q.queue({ n: v, w: k });
}
}
}
}
return 1 / 0
}
return 1/0;
};
export default findShortestPath;

View File

@@ -1,19 +1,18 @@
const findShortestPath = async (g, s, e) => {
const { default: PQ } = await import('https://esm.sh/js-priority-queue')
const q = new PQ({ comparator: (a, b) => a.w - b.w })
const d = { [s]: 0 }
const d = { [s]: 0 }, q = new PQ({ comparator: (a, b) => a.w - b.w })
q.queue({ n: s, w: 0 })
while (q.length) {
const { n, w } = q.dequeue()
if (n === e) return w
if (w > (d[n] ?? 1 / 0)) continue
const { n: u, w } = q.dequeue()
if (u === e) return w
if (w > (d[u] ?? 1 / 0)) continue
for (const [v, cost] of Object.entries(g[n] || {})) {
const t = w + cost
if (t < (d[v] ?? 1 / 0)) {
d[v] = t
q.queue({ n: v, w: t })
for (const v in g[u]) {
const nw = w + g[u][v]
if (nw < (d[v] ?? 1 / 0)) {
d[v] = nw
q.queue({ n: v, w: nw })
}
}
}

View File

@@ -1,16 +1,17 @@
const findShortestPath = async (g, s, e) => {
const { default: Q } = await import('https://esm.sh/js-priority-queue')
const d = { [s]: 0 }, q = new Q({ comparator: (a, b) => a.w - b.w })
const { default: P } = await import('https://esm.sh/js-priority-queue')
const q = new P({ comparator: (a, b) => a.w - b.w })
const d = { [s]: 0 }
q.queue({ n: s, w: 0 })
while (q.length) {
const { n, w } = q.dequeue()
if (n === e) return w
if (w > (d[n] ?? 1 / 0)) continue
for (const [v, c] of Object.entries(g[n] || {})) {
const k = w + c
if (k < (d[v] ?? 1 / 0)) {
d[v] = k
q.queue({ n: v, w: k })
for (let k in g[n]) {
const t = w + g[n][k]
if (t < (d[k] ?? 1 / 0)) {
d[k] = t
q.queue({ n: k, w: t })
}
}
}

View File

@@ -1,24 +1,19 @@
const findShortestPath = async (g, s, e) => {
const { default: PQ } = await import('https://esm.sh/js-priority-queue')
const q = new PQ({ comparator: (a, b) => a.w - b.w })
const d = { [s]: 0 }, v = new Set()
const { default: PQ } = await import('https://cdn.jsdelivr.net/npm/js-priority-queue@0.1.5/+esm')
const q = new PQ({ comparator: (a, b) => a.w - b.w }), d = { [s]: 0 }
q.queue({ n: s, w: 0 })
while (q.length) {
const { n, w } = q.dequeue()
if (n === e) return w
if (v.has(n)) continue
v.add(n)
for (const k in g[n]) {
const t = w + g[n][k]
if (t < (d[k] ?? Infinity)) {
d[k] = t
q.queue({ n: k, w: t })
if (w > (d[n] ?? 1 / 0)) continue
for (const v in g[n]) {
const k = w + g[n][v]
if (k < (d[v] ?? 1 / 0)) {
d[v] = k
q.queue({ n: v, w: k })
}
}
}
return Infinity
return 1 / 0
}
export default findShortestPath;

View File

@@ -1,25 +1,19 @@
const findShortestPath = async (g, s, e) => {
const { default: PQ } = await import('https://esm.sh/js-priority-queue');
const q = new PQ({ comparator: (a, b) => a.w - b.w });
const d = { [s]: 0 };
q.queue({ w: 0, n: s });
const { default: Q } = await import('https://esm.sh/js-priority-queue');
const q = new Q({ comparator: (a, b) => a.w - b.w }), m = { [s]: 0 };
q.queue({ n: s, w: 0 });
while (q.length) {
const { w, n } = q.dequeue();
const { n, w } = q.dequeue();
if (n === e) return w;
if (w > (d[n] ?? 1 / 0)) continue;
if (w > (m[n] ?? 1/0)) continue;
for (const v in g[n]) {
const k = w + g[n][v];
if (k < (d[v] ?? 1 / 0)) {
d[v] = k;
q.queue({ w: k, n: v });
if (k < (m[v] ?? 1/0)) {
m[v] = k;
q.queue({ n: v, w: k });
}
}
}
return 1 / 0;
return 1/0;
};
export default findShortestPath;

View File

@@ -1,19 +1,22 @@
const findShortestPath = async (g, s, e) => {
const { default: P } = await import('https://esm.sh/js-priority-queue');
const q = new P({ comparator: (a, b) => a.c - b.c }), d = { [s]: 0 };
q.queue({ n: s, c: 0 });
const { default: P } = await import('https://esm.sh/js-priority-queue')
const q = new P({ comparator: (a, b) => a.w - b.w })
const d = { [s]: 0 }
q.queue({ n: s, w: 0 })
while (q.length) {
const { n, c } = q.dequeue();
if (n === e) return c;
if (c > (d[n] ?? 1 / 0)) continue;
for (let v in g[n]) {
let k = c + g[n][v];
if (k < (d[v] ?? 1 / 0)) {
d[v] = k;
q.queue({ n: v, c: k });
const { n, w } = q.dequeue()
if (n === e) return w
if (w > (d[n] ?? Infinity)) continue
for (const k in g[n]) {
const c = w + g[n][k]
if (c < (d[k] ?? Infinity)) {
d[k] = c
q.queue({ n: k, w: c })
}
}
}
return 1 / 0;
};
return Infinity
}
export default findShortestPath;

View File

@@ -1,5 +1,5 @@
const findShortestPath = async (g, s, e) => {
const { default: PQ } = await import('https://cdn.jsdelivr.net/npm/js-priority-queue@0.1.5/+esm')
const { default: PQ } = await import('https://esm.sh/js-priority-queue')
const q = new PQ({ comparator: (a, b) => a.w - b.w })
const d = { [s]: 0 }
@@ -7,15 +7,14 @@ const findShortestPath = async (g, s, e) => {
while (q.length) {
const { n, w } = q.dequeue()
if (n === e) return w
if (w > (d[n] ?? 1 / 0)) continue
for (const k in g[n] || {}) {
const c = w + g[n][k]
if (c < (d[k] ?? 1 / 0)) {
d[k] = c
q.queue({ n: k, w: c })
for (const [v, c] of Object.entries(g[n] || {})) {
const t = w + c
if (t < (d[v] ?? 1 / 0)) {
d[v] = t
q.queue({ n: v, w: t })
}
}
}

View File

@@ -1,25 +1,23 @@
const findShortestPath = async (graph, start, end) => {
const { default: PQ } = await import('https://cdn.jsdelivr.net/npm/js-priority-queue/+esm')
const costs = { [start]: 0 }
const queue = new PQ({ comparator: (a, b) => a.cost - b.cost })
const { default: PQ } = await import('https://esm.sh/js-priority-queue')
const q = new PQ({ comparator: (a, b) => a.w - b.w })
const dist = { [start]: 0 }
q.queue({ n: start, w: 0 })
queue.queue({ node: start, cost: 0 })
while (q.length) {
const { n, w } = q.dequeue()
if (n === end) return w
if (w > (dist[n] ?? Infinity)) continue
while (queue.length) {
const { node, cost } = queue.dequeue()
if (node === end) return cost
if (cost > (costs[node] ?? Infinity)) continue
for (const [neighbor, weight] of Object.entries(graph[node] || {})) {
const nextCost = cost + weight
if (nextCost < (costs[neighbor] ?? Infinity)) {
costs[neighbor] = nextCost
queue.queue({ node: neighbor, cost: nextCost })
for (const v in graph[n]) {
const d = w + graph[n][v]
if (d < (dist[v] ?? Infinity)) {
dist[v] = d
q.queue({ n: v, w: d })
}
}
}
return Infinity
}
export default findShortestPath;

View File

@@ -0,0 +1,19 @@
const findShortestPath = async (g, s, e) => {
const { default: P } = await import('https://cdn.skypack.dev/js-priority-queue')
const d = { [s]: 0 }, q = new P({ compare: (a, b) => a.w - b.w })
q.queue({ id: s, w: 0 })
while (q.length) {
const { id, w } = q.dequeue()
if (id === e) return w
if (w > (d[id] ?? 1 / 0)) continue
for (let n in g[id]) {
const k = w + g[id][n]
if (k < (d[n] ?? 1 / 0)) {
d[n] = k
q.queue({ id: n, w: k })
}
}
}
return 1 / 0
}
export default findShortestPath;

View File

@@ -0,0 +1,22 @@
const findShortestPath = async (g, s, e) => {
const { default: PQ } = await import('https://cdn.jsdelivr.net/npm/js-priority-queue@0.1.5/+esm')
const q = new PQ({ comparator: (a, b) => a.w - b.w })
const d = { [s]: 0 }
q.queue({ n: s, w: 0 })
while (q.length) {
const { n: u, w: c } = q.dequeue()
if (u === e) return c
if (c > (d[u] ?? 1 / 0)) continue
for (const v in g[u] || {}) {
const k = c + g[u][v]
if (k < (d[v] ?? 1 / 0)) {
d[v] = k
q.queue({ n: v, w: k })
}
}
}
return 1 / 0
}
export default findShortestPath;

View File

@@ -0,0 +1,25 @@
const findShortestPath = async (g, s, e) => {
const { default: PQ } = await import('https://cdn.jsdelivr.net/npm/js-priority-queue@0.1.5/+esm')
const q = new PQ({ comparator: (a, b) => a.d - b.d })
const D = { [s]: 0 }
q.queue({ n: s, d: 0 })
while (q.length) {
const { n, d } = q.dequeue()
if (n === e) return d
if (d > (D[n] ?? 1 / 0)) continue
for (const [v, w] of Object.entries(g[n] || {})) {
const c = d + w
if (c < (D[v] ?? 1 / 0)) {
D[v] = c
q.queue({ n: v, d: c })
}
}
}
return 1 / 0
}
export default findShortestPath;

View File

@@ -0,0 +1,23 @@
const findShortestPath = async (g, s, e) => {
const { default: PQ } = await import('https://esm.sh/js-priority-queue')
const q = new PQ({ comparator: (a, b) => a.w - b.w })
const d = { [s]: 0 }
q.queue({ n: s, w: 0 })
while (q.length) {
const { n, w } = q.dequeue()
if (n === e) return w
if (w > (d[n] ?? 1 / 0)) continue
for (const v in g[n] || {}) {
const k = w + g[n][v]
if (k < (d[v] ?? 1 / 0)) {
d[v] = k
q.queue({ n: v, w: k })
}
}
}
return 1 / 0
}
export default findShortestPath;

View File

@@ -0,0 +1,21 @@
const findShortestPath = async (g, s, e) => {
const { default: P } = await import('https://esm.sh/js-priority-queue');
const q = new P({ comparator: (a, b) => a.w - b.w }), m = { [s]: 0 };
q.queue({ n: s, w: 0 });
while (q.length) {
const { n, w } = q.dequeue();
if (n === e) return w;
if (w > (m[n] ?? 1 / 0)) continue;
for (const [k, v] of Object.entries(g[n] || {})) {
const t = w + v;
if (t < (m[k] ?? 1 / 0)) {
m[k] = t;
q.queue({ n: k, w: t });
}
}
}
return 1 / 0;
};
export default findShortestPath;

View File

@@ -0,0 +1,27 @@
const findShortestPath = async (g, s, e) => {
const { default: PQ } = await import('https://esm.sh/js-priority-queue');
const q = new PQ({ compare: (a, b) => a.d - b.d });
const m = { [s]: 0 };
const v = new Set();
q.queue({ n: s, d: 0 });
while (q.length) {
const { n, d: c } = q.dequeue();
if (n === e) return c;
if (v.has(n)) continue;
v.add(n);
const adj = g[n] || {};
for (const k in adj) {
const t = c + adj[k];
if (t < (m[k] ?? Infinity)) {
m[k] = t;
q.queue({ n: k, d: t });
}
}
}
return Infinity;
};
export default findShortestPath;

View File

@@ -0,0 +1,24 @@
const findShortestPath = async (g, s, e) => {
const { default: Q } = await import('https://cdn.skypack.dev/js-priority-queue')
const q = new Q({ comparator: (a, b) => a.d - b.d })
const m = { [s]: 0 }
q.queue({ n: s, d: 0 })
while (q.length) {
const { n, d } = q.dequeue()
if (n === e) return d
if (d > (m[n] ?? 1/0)) continue
for (const v in g[n]) {
const t = d + g[n][v]
if (t < (m[v] ?? 1/0)) {
m[v] = t
q.queue({ n: v, d: t })
}
}
}
return 1/0
}
export default findShortestPath;

View File

@@ -0,0 +1,25 @@
const findShortestPath = async (graph, start, end) => {
const { default: PQ } = await import('https://esm.sh/js-priority-queue@0.1.5')
const q = new PQ({ compare: (a, b) => a.d - b.d })
const dist = { [start]: 0 }
q.queue({ n: start, d: 0 })
while (q.length) {
const { n, d } = q.dequeue()
if (n === end) return d
if (d > (dist[n] ?? Infinity)) continue
for (const [v, w] of Object.entries(graph[n] || {})) {
const t = d + w
if (t < (dist[v] ?? Infinity)) {
dist[v] = t
q.queue({ n: v, d: t })
}
}
}
return Infinity
}
export default findShortestPath;

View File

@@ -1,24 +1,25 @@
const findShortestPath = async (graph, start, end) => {
const { default: PQ } = await import('https://cdn.skypack.dev/js-priority-queue');
const queue = new PQ({ comparator: (a, b) => a.d - b.d });
const dists = { [start]: 0 }, visited = new Set();
queue.queue({ n: start, d: 0 });
const { default: PriorityQueue } = await import('https://cdn.jsdelivr.net/npm/js-priority-queue@0.1.5/+esm')
const dists = new Map([[start, 0]])
const pq = new PriorityQueue({ comparator: (a, b) => a.w - b.w })
while (queue.length) {
const { n, d } = queue.dequeue();
if (n === end) return d;
if (visited.has(n)) continue;
visited.add(n);
pq.queue({ n: start, w: 0 })
while (pq.length) {
const { n, w } = pq.dequeue()
if (n === end) return w
if (w > (dists.get(n) ?? 1 / 0)) continue
for (const [neighbor, weight] of Object.entries(graph[n] || {})) {
const newDist = d + weight;
if (newDist < (dists[neighbor] ?? Infinity)) {
dists[neighbor] = newDist;
queue.queue({ n: neighbor, d: newDist });
const newWeight = w + weight
if (newWeight < (dists.get(neighbor) ?? 1 / 0)) {
dists.set(neighbor, newWeight)
pq.queue({ n: neighbor, w: newWeight })
}
}
}
return Infinity;
};
return 1 / 0
}
export default findShortestPath;

View File

@@ -0,0 +1,25 @@
const findShortestPath = async (g, s, e) => {
const { default: PQ } = await import('https://esm.sh/js-priority-queue')
const q = new PQ({ comparator: (a, b) => a.d - b.d })
const m = { [s]: 0 }
q.queue({ n: s, d: 0 })
while (q.length) {
const { n, d } = q.dequeue()
if (n === e) return d
if (d > (m[n] ?? 1 / 0)) continue
const adj = g[n] || {}
for (const k in adj) {
const v = d + adj[k]
if (v < (m[k] ?? 1 / 0)) {
m[k] = v
q.queue({ n: k, d: v })
}
}
}
return 1 / 0
}
export default findShortestPath;