This question evaluates understanding of graph algorithms and shortest-path computation on weighted directed graphs, including handling cycles, multiple edges, and reachability in service dependency models.
You are given a set of services and directed dependencies between them. Each dependency edge represents a call from one service to another with a known latency.
0..N-1
.
(u, v, latency)
meaning service
u
can call service
v
and that hop adds
latency
milliseconds.
start
service and a
target
service, compute the
minimum total latency
along any valid call chain from
start
to
target
.
If there is no route, return -1.
N
: number of services
edges
: list of
(u, v, w)
with
w > 0
start
,
target
-1
if unreachable.