Implement algorithm for finding longest path in weighted DAG (Directed Acyclic Graph)