Given degrees of nodes, is it possible to construct a graph with those degrees, and if yes devise the algorithm?
I know of Handshaking Lemma that describes my problem, and another algorithm for it as follows:
The following algorithm decides if a simple graph can be constructed with given node degrees:
Sort the degrees in descending order.
If the first degree is $0$ (i.e. all degrees are $0$), then obviously such a graph can be formed (no edges) and you are done.
If the first degree has value $d$, then the following $d$ degrees must be greater than $0$. If not, you are done: no such graph can be formed.
Take away the first degree (value $d$) and reduce the following $d$ degrees by one (i.e. draw the requested number of edges from the node with highest degree to the nodes with highest degrees among the remaining ones), then continue with step 1 (with now one node less).
This algorithm takes $O(n^2 \log n)$ time where $n$ is number of nodes. Hence computationally very expensive!! Is there an algorithm which solves this problem in $O(n\log n)$ or $O(n)$??
NOTE:Parallel edges and loops are not allowed
Please look into the Erdos-Gallai Theorem. I am not sure of its complexity though, seems $\mathcal O(n^2)$ which all traditional algorithms for recognising graphic degree sequences are.
UPDATE:
Found this paper. Not sure of its correctness, but claims to have a linear algorithm.