input: from typing import List
  import heapq
  def edges_in_shortest_paths(n: int, edges: List[List[int]]) -> List[bool]:
      """
      Given a weighted graph with n nodes (numbered from 0 to n-1) and m edges represented in a 2D array edges, where edges[i] = [a, b, weight] represents an edge between nodes a and b with the given weight.
  
      Find all the shortest paths from node 0 to node n-1 and determine which edges are part of at least one of these shortest paths. Write and return a boolean array result where result[i] is true if the edge edges[i] is included in any shortest path, otherwise false.
  
      Return the result array.
  
      The graph might be disconnected.
      
      Examples:
      >>> n = 6, edges = [[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, edges = [[2,0,1],[0,1,1],[0,3,4],[3,2,2]]
      [true,false,false,true]
  
      Constraints:
      2 <= n <= 5 * 10^4
      m == edges.length
      1 <= m <= min(5 * 10^4, n * (n - 1) / 2)
      0 <= a, b < n
      a != b
      1 <= weight <= 10^5
      All edges are unique.
      """
output:     
      def dijkstra(start: int):
          dist = [float('inf')] * n
          dist[start] = 0
          min_heap = [(0, start)]
          while min_heap:
              d, u = heapq.heappop(min_heap)
              if d > dist[u]:
                  continue
              for v, w in adj[u]:
                  if dist[u] + w < dist[v]:
                      dist[v] = dist[u] + w
                      prev[v] = u
                      heapq.heappush(min_heap, (dist[v], v))
          return dist
  
      adj = [[] for _ in range(n)]
      for u, v, w in edges:
          adj[u].append((v, w))
          adj[v].append((u, w))
  
      dist_from_start = dijkstra(0)
      dist_to_end = dijkstra(n - 1)
  
      result = [False] * len(edges)
      for i, (u, v, w) in enumerate(edges):
          if dist_from_start[u] + w + dist_to_end[v] == dist_from_start[n - 1] or \
             dist_from_start[v] + w + dist_to_end[u] == dist_from_start[n - 1]:
              result[i] = True
  
      return result
  