Warning: foreach() argument must be of type array|object, bool given in /var/www/html/web/app/themes/studypress-core-theme/template-parts/header/mobile-offcanvas.php on line 20

Graphs with prescribed degree sequences. Given a list of n positive integers d1,d2,,dn, we want to efficiently determine whether there exists an undirected graphG=(V,E) whose nodes have degrees preciselyd1,d2,,dn . That is, if V={v1,,vn}, then the degree of vi should be exactly di. We call (d1,,dn) the degree sequence of G. This graph G should not contain self-loops (edges with both endpoints equal to the same node) or multiple edges between the same pair of nodes.

(a) Give an example of d1,d2,d3,d4 where all the di3 and d1+d2+d3+d4 is even, but for which no graph with degree sequence(d1,d2,d3,d4) exists.

(b) Suppose that d1d2d3dn and that there exists a graph G=(V,E) with degree sequence (d1,,dn). We want to show that there must exist a graph that has this degree sequence and where in addition the neighbors of v1 are v2,v3,,vdi+1 . The idea is to gradually transform G into a graph with the desired additional property.

i. Suppose the neighbors ofv1 in Gare not v2,v3,,vdi+1. Show that there exists i<jn and uV and such that {v1,vi},{u,vj}Eand {v1,vj},{u,vi}E

ii. Specify the changes you would make to G to obtain a new graph G'=(V,E') with the same degree sequence as G and where (v1,vi)E'.

iii. Now show that there must be a graph with the given degree sequence but in which v1 has neighbors v2,v3,,vdi+1.

c) Using the result from part (b), describe an algorithm that on input d1,,dn (not necessarily sorted) decides whether there exists a graph with this degree sequence. Your algorithm should run in time polynomial in n and in m=i=1ndi .

Short Answer

Expert verified

a. Example is given.

b. (i) The given can be proved.

(ii) The new graphG'=(V,E') has same degree as sequence of graph G.

(iii) The execution process will always end, because degree sequence d1 is finite.

c. The above algorithm's concurrent execution in terms of n and m=i=1i=ndi is O(nlogn+m).

Step by step solution

01

Input Positive contributions

a)

Another collection of n positive numbers is provided as input. d1,d2,d3,d4. To choose another input values for, apply the following condition d1,d2,d3,d4. The first requirement is that "all contributions must be less than as well as equal to 3(di3). The second criterion is that the total number of inputs must be an even amount d1,d2,d3,d4.

Example:

Choose the appropriate values for d1,d2,d3,d4. Choose values of d1,d2,d3,d4as long as it is less than as well as equal to three. Consider the values of d1 as 3, d2 as 3, d3 as 1, andd4 as 1 . Thus, selected value of d1,d2,d3, and d4 is (3, 3, 1, 1) that satisfies the first condition (di3).

Check if the inputs meet the second criteria as follows,

d1+d2+d3+d4=3+3+1+1=8

This degree series is even, and there is no graph with for this degree pattern. The total of the all the input is even and it fulfils the second criteria..

Therefore, one of the possible valid example is d1,d2,d3,d4 with the values 1,1,3,3.

02

Confirmation of vertices

b)

(i)

Proof:

Consider the given graph Gcontains the vertex V1 which is neighbor of d1. Because, they are not vertices such as v2,v3,,vdi+1. By definition (v1,vj)Efor some j value with the range of d1+1<jnand (v1,vj)Efor some i value with the range of 1<idj+1. This implies iand jvalue with range of i<jn.

By definition, vertex vjcontains the d1 neighbors for jand vertex vIcontains the di neighbors for i. From this, vertex vjis a neighbor of vin the condition of dj>0. The order of degree indicates that didj. Since, the condition for i and j is i<j.

The vertex v1 is a neighbor of vj, but it is not the neighbor of vi. In other words, it simply specifies (v1,vj)E and (v1,vj)E.

Therefore, the condition didj indicates that there must be some vertex uvj.

That is, vertex u is a neighbor of vi but, it is not the neighbor of vj. In other words, it simply specifies (u,vi)E and (u,vi)E.

Therefore, the graph G exists in the condition of i<jn and uVsuch that (v1,vi),(u,vi)E and (v1,vi),(u,vi)E.

ii)

Consider the new graphG' derived from the graph G.In the graph G, remove the edges such as (v1,vi) and (u,vi) and add the edges of (v1,vi)and (u,vi) to get the new graph G'.

E=E{(v1,vi),(u,vi)}/{(v1,vi),(u,vi)}

Note that the vertices v1,vi,vj,uV and the degree does not change. Then, the new graph G'=(V,E')has same degree sequence of graphG and (v1,vi)Ethat is,(v1,vi)is an edge.

Therefore, the new graph G'=(V,E')has same degree as sequence of graph G.

iii)

Proof:

Iterate the above b (i) and b (ii) procedure until the neighbors of verticesv1 are v2,,vd1+1.

Therefore, the execution process will always end, because degree sequence d1 is finite.

03

Algorithm for the given input.

c)

Algorithm:

Note: Refer the Question No: 27 (b) in the textbook.

From the above procedure, Consider that the graph Gis exist on nvertices with the degree sequence ofd1,d2,,dn. Likewise, if n1vertices contains the degree sequence of

d1,d21,,dd1+11,dd1+2,,dn

Input:degree sequenced1,d2,,dn .

Output:The graph is exist on vertices with the degree sequence of d1,d2,,dn.

//Check whether the degree sequence is 0

If d1=0:

//Display the output

Output is "The graph is not exist on vertices"

//Sort the degree sequenced1,d2,,dn in the decreasing order

Sort the degree sequence in decreasing order

//Execute until the list not more than n1

for list i is not more than n1

//Check whether the degree sequence di is less than

if di<0:

//Display the output when base case is not empty list

Output is "The graph is not exist on nvertices"

else:

//Delete the degree sequence from the list

Remove di from the list

//Subtract the degree sequence by 1

Decrement degree sequence d2,d3,,dd1+1by 1

//Display the output when base case is empty list

Output is "The graph is exist on nvertices"

Explanation:

Use the recursive procedure for given degree sequence d1,d2,,dn .Check whether the degree sequence contains the length of 1. Sort the degree sequence d1,d2,,dnin the decreasing order. Verify the condition whether the degree sequence di<0. If the condition satisfies, display the graph is not exist on nvertices.

If the condition is not satisfied, remove d1 from the sequence and subtract d2,,dd1+1 by 1. Repeat the steps until the list no more than of n1 Finally, the base case list is empty and displays the graph is exist on “n” vertices with degree sequence d1,d2,,dn.

Therefore, the graph G is exists on n vertices with degree sequence ofd1,d2,,dn.

Complexity:

• Each unique degree order is sortedd1,d2,,dn .This insertion sort, on the other hand, reduces overall running time by such a factor of twoO(nlogn) . With each and every process, there should be at least one repetitive procedure call di in the degree sequence takes Oi=1i=ndi.

As a result, when the sorting plus recursive function calls are added together, overall total running time is O(nlogn+i=1i=ndi).

The duration of the film is O(nlogn+m) .

Therefore, The above algorithm's concurrent execution in terms of n and m=i=1i=ndi is O(nlogn+m).

Unlock Step-by-Step Solutions & Ace Your Exams!

  • Full Textbook Solutions

    Get detailed explanations and key concepts

  • Unlimited Al creation

    Al flashcards, explanations, exams and more...

  • Ads-free access

    To over 500 millions flashcards

  • Money-back guarantee

    We refund you if you fail your exam.

Over 30 million students worldwide already upgrade their learning with Vaia!

One App. One Place for Learning.

All the tools & learning materials you need for study success - in one app.

Get started for free

Most popular questions from this chapter

Ternary A server has customers waiting to be served. The service time required by eachcustomer is known in advance: it is ciminutes for customer i. So if, for example, the customers are served in order of increasing i , then the ithcustomer has to wait Pij=1tjminutes. We wish to minimize the total waiting time.

T=Xni=1(time spent waiting by customer ).

Give an efficient algorithm for computing the optimal order in which to process the customers.

A binary counter of unspecified length supports two operations: increment (which increases its value by one) and reset (which sets its value back to zero). Show that, starting from an initially zero counter, any sequence of n increment and reset operations takes time O(n); that is, the amortized time per operation is O(1) .

The basic intuition behind Huffman’s algorithm, that frequent blocks should have short encodings and infrequent blocks should have long encodings, is also at work in English, where typical words like I, you, is, and, to, from, and so on are short, and rarely used words like velociraptor are longer.

However, words like fire!, help!, and run! are short not because they are frequent, but perhaps because time is precious in situations where they are used.

To make things theoretical, suppose we have a file composed of m different words, with frequencies f1,...,fm. Suppose also that for the ithword, the cost per bit of encoding is ci. Thus, if we find a prefix-free code where the ithword has a codeword of length Ii, then the total cost of the encoding will be localid="1659078764835" fi·ci·li.

Show how to modify Huffman’s algorithm to find the prefix-free encoding of minimum total cost.

We use Huffman's algorithm to obtain an encoding of alphabet {a,b,c}with frequencies fa,fb,fc. In each of the following cases, either give an example of frequencies (fa,fb,fc)that would yield the specified code, or explain why the code cannot possibly be obtained (no matter what the frequencies are).

(a) Code:{0,10,11}

(b) Code:{0,1,00}

(c) Code:{10,01,00}

Show how to find the maximum spanning tree of a graph, that is , the spanning tree of largest total weight.

See all solutions

Recommended explanations on Computer Science Textbooks

View all explanations

What do you think about this solution?

We value your feedback to improve our textbook solutions.

Study anywhere. Anytime. Across all devices.

Sign-up for free