Pensieve header: The 8-5-3 milk jug problem.

{(Subscript[c, 1]),(Subscript[c, 2]),(Subscript[c, 3])}={8,5,3};
vs={v[8,0,0]}; es={};
AddEdge[from_,to_] := If[Plus@@to≥4,
If[!MemberQ[vs, to], AppendTo[vs, to]];
AppendTo[es, from\[DirectedEdge]to]
];
k=0;
While[k<Length@vs,
x=vs[[++k]];
For[i=1, i≤3, ++i,
If[x[[i]]>0,
For[j=1, j≤3, ++j,
If[i==j, AddEdge[x, ReplacePart[x, i->0]],
If[x[[i]]+x[[j]]≤(Subscript[c, j]),AddEdge[x, ReplacePart[x, {i->0, j->x[[i]]+x[[j]]}]]];
If[x[[i]]+x[[j]]>(Subscript[c, j])∧x[[j]]<(Subscript[c, j]),
AddEdge[x, ReplacePart[x, {i->x[[i]]+x[[j]]-(Subscript[c, j]), j->(Subscript[c, j])}]]
]
]
]
]
]
]
G=Graph[vs,es, VertexLabels->"Name"]

path=FindShortestPath[G,v[8,0,0],v[4,0,0]]

Length@path

FindShortestPath[G,v[8,0,0],v[1,4,3]]

HighlightGraph[
Graph[vs, Union[Sort/@UndirectedEdge@@@es], VertexLabels -> {x_v:>StringJoin@@(ToString/@x)}],
PathGraph[path]
]

vs

Length@vs

es

Subgraph[G, Select[vs, 8==Plus@@#&], VertexLabels->"Name"]