Let's say I have a map with factories and selling points. I want to trace the paths from factories to the selling points with the lower possible cost.
The image bellow is an example of a possible solution for that map, then the output of the algorithm should be two trees with the edges of those trees.
If there is only one factory a possible solution would be using Kruskal's algorithm to find the MST with this factory as source.
¿Is there any algorithm to do so? ¿How would a modification of Kruskal's work?
[EDIT] I need to find the minimum cost tree from factories to shops but given that there is more than one factory may have unconnected trees as optimal solution.
[EDIT 2] If an edge is used twice that cost counts only once.