Docs: Update benchmark for openrouter/bert-nebulon-alpha

This commit is contained in:
github-actions[bot]
2025-11-25 21:20:48 +00:00
parent 40160415c2
commit a175f18319
12 changed files with 333 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
const findShortestPath = async (graph, start, end) => {
const { default: PriorityQueue } = await import('https://cdn.jsdelivr.net/npm/js-priority-queue@1.0.0/+esm')
if (!graph[start] || !graph[end]) return Infinity
const distances = Object.keys(graph).reduce((acc, node) => {
acc[node] = node === start ? 0 : Infinity
return acc
}, {})
const pq = new PriorityQueue({ comparator: (a, b) => a.distance - b.distance })
pq.queue({ node: start, distance: 0 })
const visited = new Set()
while (pq.length) {
const { node, distance } = pq.dequeue()
if (node === end) return distance
if (visited.has(node)) continue
visited.add(node)
Object.entries(graph[node]).forEach(([neighbor, weight]) => {
if (visited.has(neighbor)) return
const newDistance = distance + weight
if (newDistance < distances[neighbor]) {
distances[neighbor] = newDistance
pq.queue({ node: neighbor, distance: newDistance })
}
})
}
return Infinity
}
export default findShortestPath;