Given an undirected graph with success probabilities on edges, return the maximum probability of reaching the destination from the start. Pattern focus: Dijkstra. Use a max-priority queue or an equivalent transformation so higher-probability states are expanded first.
n = node count, edges = undirected edges, succProb = edge probabilities, start = source, end = destination
maximum success probability from start to end
Example 1:
Input:
n = 3 edges = [[0,1],[1,2],[0,2]] succProb = [0.5,0.5,0.2] start = 0 end = 2
Output:
0.25
Explanation:
The best path is 0 -> 1 -> 2 with probability 0.25.
Example 2:
Input:
n = 3 edges = [[0,1]] succProb = [0.7] start = 0 end = 1
Output:
0.7
Explanation:
There is a single direct edge.
Example 3:
Input:
n = 3 edges = [[0,1]] succProb = [0.7] start = 0 end = 2
Output:
0.0
Explanation:
The destination is unreachable.