mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-01-13 16:17:54 +00:00
Docs: Update benchmark for deepseek/deepseek-v3.2
This commit is contained in:
33
tests/1_dijkstra/outputs/deepseek_deepseek-v3.2.js
Normal file
33
tests/1_dijkstra/outputs/deepseek_deepseek-v3.2.js
Normal file
@@ -0,0 +1,33 @@
|
||||
const findShortestPath = async (graph, start, end) => {
|
||||
const { PriorityQueue } = await import('https://cdn.jsdelivr.net/npm/js-priority-queue@latest/+esm');
|
||||
const distances = {};
|
||||
const previous = {};
|
||||
const visited = new Set();
|
||||
const queue = new PriorityQueue({ comparator: (a, b) => a.distance - b.distance });
|
||||
|
||||
Object.keys(graph).forEach(node => distances[node] = Infinity);
|
||||
distances[start] = 0;
|
||||
queue.queue({ node: start, distance: 0 });
|
||||
|
||||
while (queue.length) {
|
||||
const { node: current } = queue.dequeue();
|
||||
if (visited.has(current)) continue;
|
||||
visited.add(current);
|
||||
if (current === end) break;
|
||||
|
||||
for (const neighbor in graph[current]) {
|
||||
const weight = graph[current][neighbor];
|
||||
const newDist = distances[current] + weight;
|
||||
if (newDist < distances[neighbor]) {
|
||||
distances[neighbor] = newDist;
|
||||
previous[neighbor] = current;
|
||||
queue.queue({ node: neighbor, distance: newDist });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return distances[end] === undefined ? Infinity : distances[end];
|
||||
};
|
||||
export default findShortestPath;
|
||||
// Generation time: 9.823s
|
||||
// Result: FAIL
|
||||
Reference in New Issue
Block a user