expand[a_]:=Table[{i,Sequence@@a},{i,0,a[[1]]}];L[1,n_]:=Table[{i},{i,0,n}];L[m_,n_]:=Sort[Join@@Map[expand,L[m-1,n]]];edgesR[sa_]:=Module[{r,im,t=1,s},s=Map[First,sa];im=IdentityMatrix[Length[s[[1]]]];r=Table[Null,Length[s]*Length[s[[1]]]];Do[r[[t++]]=If[MemberQ[s,e+i]&&Union[((e+i)/.sa)-(e/.sa),{0}]=={0,1},{e,e+i},Nothing],{e,s},{i,im}];r];edges[s_]:=edgesR[Map[#->#&,s]];coords[a_,p_]:=Module[{l},l=Length[a];Table[{i*50-25*l,p*30},{i,1,l}]];Options[youngLattice]={ItemSize->10,GraphLayout->Left};data[m_,n_]:=Module[{v,e,p,v2i,i2v},p=If[n==0,Table[IntegerPartitions[i],{i,0,m}],Table[Select[IntegerPartitions[i],Length[#]<=m&&(Length[#]==0||First[#]<=n)&],{i,0,m*n}]]/.{}->{0};v=Map[PadRight[#,m]&,Apply[Join,p]];e=edges[v];v2i=MapIndexed[#1->First[#2]&,v];i2v=MapIndexed[First[#2]->#1&,v];{p,v,e,v2i,i2v}];youngLattice[m_,n_Integer:0,OptionsPattern[]]:=Module[{v,e,vl,c,p,vc,v2i,i2v},{p,v,e,v2i,i2v}=data[m,n];c=Apply[Join,MapIndexed[coords[#1,First[#2]]&,p]];vl=Table[Evaluate[t/.v2i]->Placed[youngDiagram[t/.{0->Nothing},ItemSize->OptionValue[ItemSize]],Center],{t,v}];vc=Switch[OptionValue[GraphLayout],Up,Map[{#[[1]],-#[[2]]}&,c],Down,Map[{#[[1]],#[[2]]}&,c],Left,Map[{#[[2]],#[[1]]}&,c],Right,Map[{-#[[2]],#[[1]]}&,c]];Graph[Map[#[[1]]->#[[2]]&,e]/.v2i,VertexLabels->vl,VertexCoordinates->vc]];