I recently solved a problem of the longest path by using BFS twice. I also learned that dynamic programming can be used to solve the longest path in a directed acyclic graph