# This is a Maple file, it computes all partitions consisting of only
# degree-1 and degree-2 places.

IsSubList := proc(L1, L2)
	local i;
	if L1 = [] then
		true
	elif nops(L1) > nops(L2) then
		false
	else
		for i to nops(L2) do
			if L2[i] >= L1[1] then
				return procname(L1[2..-1], subsop(i=NULL, L2))
			fi
		od;
		false
	fi
end:

OccursAsSubList := proc(L,S)
	local i;
	for i in S do
		if i<>L and IsSubList(L,i) then
			return true
		fi
	od;
	false
end:

for i to 5 do
	V1[i] := subs(1=NULL, {seq(`if`(nops(j)>=6,j,NULL), j = combinat[partition](16-2*i))});
	V1[i] := {seq(`if`(OccursAsSubList(j, V1[i]), NULL, j), j = V1[i])};
	V2[i] := { op(combinat[partition](i)) };
	#
	# Skip partitions with max(mult deg1) + max(mult deg2) <= 4 because those have already
	# been covered in Part I.
	#
	W[i] := {seq(seq(`if`( max(1,op(map(op,j))) + max(1,op(map(op,k))) > 4, [j,k], NULL), j=V1[i] ), k = V2[i])};
od:
#
# i = the number of degree-2 places, counted with multiplicity.
# The case i=0 is already treated in Part I, so i runs from 1 to 5.
#
interface(screenwidth = 500):
for i to 5 do
	# If i=1 (only 1 degree-2 place, and multiplicity 1) then list only the
	# multiplicities of the deg1 places, and only those that are >2 since all
	# cases will use at least a 2*cuspsum.
	lprint(i, "deg-2 places, cover:", `if`(i=1,subs(2=NULL,{seq(j[1],j=W[1])}), W[i]))
od;
