Is there a known (efficient) algorithm to construct a non-connected graph with a given degree sequence (if it exists)? ---- ### Examples - The sequence $\{3, 2, 2, 2, 2, 2, 1\}$ has both connected and non-connected realizations as simple graphs: [![enter image description here][1]][1] All non-connected realizations of this sequence are isomorphic to the graph shown above. The algorithm should construct such a graph. - All realizations of the sequence $\{3, 3, 1, 1, 1, 1\}$ are connected (it's a forcibly connected sequence) and isomorphic to: [![enter image description here][2]][2] The algorithm should either fail on this sequence, or construct a connected graph like the one above. ---- To help with experimentation, the following is an exhaustive list of degree sequences of size $\le 7$ that have both connected and non-connected realizations: {2, 2, 2, 1, 1} {{3, 2, 2, 1, 1, 1}, {2, 2, 2, 2, 1, 1}, {3, 3, 2, 2, 1, 1}, {2, 2, 2, 2, 2, 2}, {3, 3, 3, 3, 1, 1}} {{4, 2, 2, 1, 1, 1, 1}, {3, 3, 2, 1, 1, 1, 1}, {4, 3, 2, 2, 1, 1, 1}, {4, 4, 2, 2, 2, 1, 1}, {3, 2, 2, 2, 1, 1, 1}, {4, 2, 2, 2, 2, 1, 1}, {2, 2, 2, 2, 2, 1, 1}, {3, 2, 2, 2, 2, 2, 1}, {3, 3, 2, 2, 2, 1, 1}, {3, 3, 3, 2, 1, 1, 1}, {4, 3, 3, 2, 2, 1, 1}, {4, 3, 3, 3, 1, 1, 1}, {4, 4, 3, 3, 2, 1, 1}, {2, 2, 2, 2, 2, 2, 2}, {3, 3, 2, 2, 2, 2, 2}, {3, 3, 3, 3, 2, 1, 1}, {4, 3, 3, 3, 3, 1, 1}, {4, 4, 4, 3, 3, 1, 1}, {3, 3, 3, 3, 2, 2, 2}, {4, 4, 4, 4, 4, 1, 1}} [1]: https://i.sstatic.net/tsEg0.png [2]: https://i.sstatic.net/EtHNB.png