7
1
This challenge will give you an input of a degree sequence in the form of a partition of an even number. Your goal will be to write a program that will output the number of loop-free labeled multigraphs that have this degree sequence.
Example
For example, given the input [3,3,1,1]
, you should output the number of labeled multigraphs on four vertices \$\{v_1, v_2, v_3, v_4\}\$ such that \$\deg(v_1) = \deg(v_2) = 3\$ and \$\deg(v_3) = \deg(v_4) = 1\$. In this example, there are three such multigraphs:
See Gus Wiseman's links on OEIS sequence A209816 for more examples.
Target data
input | output
----------------+--------
[6,2] | 0
[5,3,2] | 1
[3,3,1,1] | 3
[4,3,1,1,1] | 6
[4,2,1,1,1,1] | 10
[1,1,1,1,1,1] | 15
[3,2,2,2,1] | 15
[2,2,2,2,2] | 22
[7,6,5,4,3,2,1] | 7757
Challenge
This is code-golf so shortest code in bytes wins.
i<-[0..h]
seems to be the better way to trade time for code length... – Christian Sievers – 2019-10-29T20:20:19.320