Construct a connected graph with given degrees

Revision en2, by pas.andrei, 2015-11-11 23:16:47

I am trying to solve this problem in which I am given a number n, representing the number of vertexes in a undirected graph. On the next line there are n natural numbers representing the degree of the respective vertex. I am asked to find the edges, such that the graph is connected.

n<=5000 and it is forbbiden that two or more edges connect the same two vertexes.

LE: Also, there will always exist a graph with the degrees given in the tests.

Tags graph, constructive, degree

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English pas.andrei 2015-11-11 23:16:47 82
en1 English pas.andrei 2015-11-11 21:31:21 414 Initial revision (published)