title: Multiple Source Multiple Destination shortest path
body: <p>Let's say we have a maze, which has a width of W and a height of H. In this maze there are multiple people and multiple towers. The people are the sources (S) and the towers (D) are the destinations. It should be known that we have an omniscient view of the maze. My question is then this:</p>
  
  <p>If I want to find the shortest path between any of the different SD combinations, how do I go about this?</p>
  
  <p>At first, I can think of a naive solution that involves breaking this down into SD different OSOD operations, the problem is that this is quite time-consuming.</p>
  
  <p>The second option would be to break it down into S different OSMD operations. But this I suspect is still too time inefficient for what I'm looking for. </p>
  
  <p>I need an algorithm that can perform the pathfinding in O(W<em>H) time. I've not been able to find anything that gives me the shortest path in O(W</em>H) time and which is MSMD based. Hopefully, someone can point me in the right direction.</p>