The best way to design sewers

Is there any algorithm (s) that can find all the paths between the source and receiver in a given, non-directional, weighted graph / network? A network consists of several source nodes and one shell node. The path must be free of cycles

+3
source share
3 answers

I would approach this using the A * algorithm with the following differences from the basic path search.

  • Start with a sink instead of a source, as there is only one sink
  • Each node is a set of positions instead of one position. At each iteration, add the neighbors of all positions to the queue. Also create branches for all neighbors so that there is another position in the next set. Limit the maximum number of line items to the number of sources as an optimization.
  • Keep track of what sources you have reached in every way
  • The cost function should be the total distance traveled with all the forked paths combined
  • The evaluation function should combine all other sources

This should give optimal paths if the A * algorithm is used correctly.

+1
source

, . , , .

0

It looks like a Minimal Spanning Tree .

0
source

Source: https://habr.com/ru/post/1766931/


All Articles