Consider the directed graph G=(V,A) where each directed arc (i,j) $\in A$ has associated with it a distance $d_{ij}$. Formulate a minimum cost network flow model that will identify the shortest paths and their lengths from 1 to every o
ther vertex in G.
(From Rader page 83)
My original idea was that wanted to minimize $\sum_{j=2}^{7}d_{1j}$ but that doesn't work because that doesn't take the correct paths into account.
The constraints are a little easier but I'm not sure what to do for the minimization equation
Define your decision variable $f_{ij}$ as the flow along arc $(i,j)$. Let node 1 be the supply node ($s$), and pick a node other than 1 as your demand ($d$). Then, your MCNF problem is simply $$ \min \sum_i \sum_j d_{ij}f_{ij}$$ subject to: $$ \sum_i f_{ij} - \sum_i f_{ji} = \begin{cases} -1, \text{if } j = s\\ +1, \text{if } j = d\\ 0, \text{otherwise} \end{cases}$$
The constraints enforce flow balance: supply has to send 1, demand has to get it, everything else is intermediate so whatever comes in has to leave. The flow balance is written as (inflow - outflow). Because your constraint matrix is totally unimodular, the flow decision variables will be integral, in particular either 0 or 1 because of the RHS of the constraints. Since they're either 0 or 1, they act as switches for your objective function, turning "on" only your traveled path, which is accrued to your running total and minimized.