Given a directed graph, I need to find the minimum set of vertices from which all other vertices can be reached. 

So the result of the function should be the smallest number of vertices, from which all other vertices can be reached by following the directed edges. 

The largest result possible would be if there were no edges, so all nodes would be returned.

If there are cycles in the graph, for each cycle, one node is selected. It does not matter which one, but it should be consistent if the algorithm is run again. 

I am not sure that there is an existing algorithm for this? If so does it have a name? I have tried doing my research and the closest thing seems to be finding a [mother vertex](https://stackoverflow.com/questions/4311614/how-to-find-mother-vertex-in-a-directed-graph-in-onm)
If it is that algorithm, could the actual algorithm be elaborated as the answer given in that link is kind of vague.

Given I have to implement this in javascript, the preference would be a .js library or javascript example code.