Least number of Unique Edges from A and B to D

Правка en2, от jankit366, 2024-09-11 13:03:38

A and B wants to reach some destination in an undirected graph using the least number of unique edges. Find the count of unique edges.

Let's say the two paths come out to be this.. A-x-y-D B-y-D

Output : 4

Explanation : A-x, x-y, y-D and B-y

Follow up: What if there are multiple sources?

Can someone help me to solve this optimally?

Теги bfs, multisource bfs, mssp

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский jankit366 2024-09-11 13:03:38 17 Tiny change: 'A and B wa' -> 'LeatA and B wa'
en1 Английский jankit366 2024-09-11 12:59:08 393 Initial revision (published)