Tap here to switch tabs
Problem
Ask
Submissions

Problem: Path with Maximum Probability

med
30 min
Explore how to determine the path with maximum probability between two nodes in an undirected weighted graph. Learn to apply graph theory and algorithmic techniques to evaluate paths based on given edge success probabilities. This lesson helps you understand problem constraints and develop a solution approach to maximize traversal success.

Statement

You are given an undirected weighted graph of n nodes, represented by a 0-indexed list, edges, where edges[i] = [a, b] is an undirected edge connecting the nodes a and b. There is another list succProb, where succProb[i] is the probability of success of traversing the edge edges[i].

Additionally, you are given two nodes, start and end. Your task is to find the path with the maximum probability of success to go from start to end and return its success probability. If there is no path from start to end, return 0.

Constraints:

  • 22 \leq n 103\leq 10^3

  • 00 \leq start, end << n

  • start \neq end

  • 00 \leq a, b << n

  • a \neq b

  • 00 \leq succProb.length ==== edges.length 2×103\leq 2\times10^3

  • 00 \leq succProb[i] 1\leq 1

  • There is, at most, one edge between every two nodes.

Tap here to switch tabs
Problem
Ask
Submissions

Problem: Path with Maximum Probability

med
30 min
Explore how to determine the path with maximum probability between two nodes in an undirected weighted graph. Learn to apply graph theory and algorithmic techniques to evaluate paths based on given edge success probabilities. This lesson helps you understand problem constraints and develop a solution approach to maximize traversal success.

Statement

You are given an undirected weighted graph of n nodes, represented by a 0-indexed list, edges, where edges[i] = [a, b] is an undirected edge connecting the nodes a and b. There is another list succProb, where succProb[i] is the probability of success of traversing the edge edges[i].

Additionally, you are given two nodes, start and end. Your task is to find the path with the maximum probability of success to go from start to end and return its success probability. If there is no path from start to end, return 0.

Constraints:

  • 22 \leq n 103\leq 10^3

  • 00 \leq start, end << n

  • start \neq end

  • 00 \leq a, b << n

  • a \neq b

  • 00 \leq succProb.length ==== edges.length 2×103\leq 2\times10^3

  • 00 \leq succProb[i] 1\leq 1

  • There is, at most, one edge between every two nodes.