generate longest path