add method to topSort directed graph, and use passing functions in deep first search, to be able to adapt this function to different appliances