I would like to have a function `generateConnected[list_]`

that, given a set of vertices with pre-defined valence (number of outgoing edges) generates all possible connected diagrams.

For example, let us choose the following names for vertices of valence `1`

through `6`

:

`vertexNames = { x , u , y , z , q , w }; `

which means, a vertex of label `x`

can have only one edge attached to it, `u`

can have only 2 edges, `y`

can have only three edges etc.

Then a set of vertices might be chosen e.g. as follows, so that the output is

`set = Flatten[{Array[x, 5], y , z }] generateConnected[set,vertexNames] `

`{ x[1] , x[2] , x[3] , x[4] , x[5] , y , z }`

Is there an efficient way to do this in Mathematica?