input: from typing import List
  import heapq
  def find_critical_edges(n: int, connections: List[List[int]]) -> List[bool]:
      """
      You have an undirected weighted graph with n nodes labeled from 0 to n - 1. The graph is composed of m edges given by a 2D array connections, where connections[i] = [u_i, v_i, w_i] signifies an edge between nodes u_i and v_i with weight w_i.
  
      Evaluate all the shortest paths from node 0 to node n - 1 in this graph. Determine a boolean array result where result[i] is true if the edge connections[i] is part of at least one shortest path. If not, result[i] should be false.
  
      Return the boolean array result.
  
      Note that the graph might be disconnected.
  
      Examples:
      >>> n = 6, connections = [[0,1,4],[0,2,1],[1,3,2],[1,4,3],[1,5,1],[2,3,1],[3,5,3],[4,5,2]]
      [true,true,true,false,true,true,true,false]
      >>> n = 4, connections = [[2,0,1],[0,1,1],[0,3,4],[3,2,2]]
      [true,false,false,true]
  
      Constraints:
      2 <= n <= 5 * 10^4
      m == connections.length
      1 <= m <= min(5 * 10^4, n * (n - 1) / 2)
      0 <= u_i, v_i < n
      u_i != v_i
      1 <= w_i <= 10^5
      There are no duplicate edges.
      """
output:     
      from collections import defaultdict
      import sys
  
      def dijkstra(start, graph, n):
          distances = {i: sys.maxsize for i in range(n)}
          distances[start] = 0
          pq = [(0, start)]
          while pq:
              current_distance, current_node = heapq.heappop(pq)
              if current_distance > distances[current_node]:
                  continue
              for neighbor, weight in graph[current_node]:
                  distance = current_distance + weight
                  if distance < distances[neighbor]:
                      distances[neighbor] = distance
                      heapq.heappush(pq, (distance, neighbor))
          return distances
  
      # Create the graph
      graph = defaultdict(list)
      for u, v, w in connections:
          graph[u].append((v, w))
          graph[v].append((u, w))
  
      # Find the shortest distances from node 0 to all other nodes using Dijkstra's algorithm
      dist_from_start = dijkstra(0, graph, n)
  
      # Find the shortest distances from node n-1 to all other nodes using Dijkstra's algorithm on reversed graph
      reversed_graph = defaultdict(list)
      for u, v, w in connections:
          reversed_graph[v].append((u, w))
          reversed_graph[u].append((v, w))
  
      dist_to_end = dijkstra(n - 1, reversed_graph, n)
  
      shortest_path_length = dist_from_start[n - 1]
      result = [False] * len(connections)
  
      # Check if including this edge gives a path equal to the shortest path length
      for idx, (u, v, w) in enumerate(connections):
          if dist_from_start[u] + w + dist_to_end[v] == shortest_path_length or dist_from_start[v] + w + dist_to_end[u] == shortest_path_length:
              result[idx] = True
  
      return result
  