function dijkstra(graph, startNode) {
  // Create a set of unvisited nodes.
  const unvisited = new Set(graph.nodes);

  // Create a map of distances from the start node to each node.
  const distances = new Map();
  for (const node of graph.nodes) {
    distances.set(node, Infinity);
  }

  // Set the distance from the start node to itself to zero.
  distances.set(startNode, 0);

  // Create a priority queue of nodes, sorted by their distance from the start node.
  const priorityQueue = new PriorityQueue();
  priorityQueue.add(startNode, 0);

  // While the priority queue is not empty:
  while (!priorityQueue.isEmpty()) {
    // Remove the node with the lowest distance from the priority queue.
    const currentNode = priorityQueue.remove();

    // Mark the current node as visited.
    unvisited.delete(currentNode);

    // For each neighbor of the current node:
    for (const neighbor of graph.getNeighbors(currentNode)) {
      // Calculate the tentative distance to the neighbor.
      const tentativeDistance = distances.get(currentNode) + graph.getEdgeWeight(currentNode, neighbor);

      // If the tentative distance is less than the current distance to the neighbor:
      if (tentativeDistance < distances.get(neighbor)) {
        // Update the distance to the neighbor.
        distances.set(neighbor, tentativeDistance);

        // Add the neighbor to the priority queue.
        priorityQueue.add(neighbor, tentativeDistance);
      }
    }
  }

  // Return the map of distances.
  return distances;
}
spam fails_task lang_mismatch pii not_appropriate hate_speech sexual_content quality toxicity humor helpfulness creativity violence