Suppose I had this [Directed Acyclic Graph (DAG)](http://en.wikipedia.org/wiki/Directed_acyclic_graph), where there is a directed edge from each node (other than the nodes in the bottom row) to the two nodes below it:

```
        7
      3   8
    8   1   0
  2   7   4   4
4   5   2   6   5

```

I need to find a path through this DAG where the sum of the nodes' weights is maximized. You can only move diagonally down-left or down-right from a node in this tree. So for example, 7, 3, 8, 7, 5, would give the maximum path in this tree. 

The input file contains the DAG formatted in this way

```
7
3 8
8 1 0
2 7 4 4
4 5 2 6 5

```

My question is, what algorithm would be best to find maximum path and also how would this tree be represented in C++?

The node weights are non-negative.