3123. Find Edges in Shortest Paths
You are given an undirected weighted graph of
n
nodes numbered from 0 ton - 1
. The graph consists ofm
edges represented by a 2D arrayedges
, whereedges[i] = [ai, bi, wi]
indicates that there is an edge between nodesai
andbi
with weightwi
.Consider all the shortest paths from node 0 to node
n - 1
in the graph. You need to find a boolean arrayanswer
whereanswer[i]
istrue
if the edgeedges[i]
is part of at least one shortest path. Otherwise,answer[i]
isfalse
.Return the array
answer
.Note that the graph may not be connected.