algorithm for enumeration of all routes in graph