For a given graph, I need to find the minimum set of vertices from which all other vertices can be reached.
Thus, the result of the function should be the smallest number of vertices from which all other vertices can be reached by following oriented edges.
The biggest result would be if there were no edges, so all nodes will be returned.
If there are cycles on the chart, one node is selected for each cycle. It doesn't matter which one, but it should be consistent if the algorithm starts again.
I'm not sure if there is an existing algorithm for this? If he has a name? I tried to do my research, and the closest thing seemed to find the poppy peak. If this is that algorithm, the actual algorithm could be developed, since the answer provided in this link is rather vague.
Given that I have to implement this in javascript, the preference would be a .js library or sample javascript code.
source share