In an undirected graph, the degreed(u) of a vertex u is the number of neighbours u is the number of neighbors u has, or equivalently, the number of edges incident upon it. In a directed graph, we distinguish between the indegreedin(u), which is the number of edges into u, and the outdegreedout(u), the number of the edges leaving u.

(a) Show that in an undirected graph, role="math" localid="1658908755010" uevd(u)=2|E|

(b) Use part (a) to show that in an undirected graph, there must be an even number of vertices whose degree is odd.

(c) Does a similar statement hold for the number of vertices with odd indegree in a directed graph?

Short Answer

Expert verified

(a) It can be proved that in an undirected graph,uevd(u)=2|E|.

(b) Using part (a). it has been shown that in an undirected graph, there must be an even number of vertices whose degree is odd.

(c) No, a similar statement does not hold for the number of vertices with odd indegree in a directed graph.

Step by step solution

01

Explain the undirected graph and the degree

Consider the graph, that has edges without arrows that point in no direction. The degree is the number that represents the number of incoming edges of the

02

Show that in an undirected graph,∑uev d(u)=2|E|

(a)

For any edge (u,v), it contributes a degree to vertexu and vertexv at the same time. So, the edges correspond to two degrees, so the degree of the vertices is as follows.

uevd(u)=2|E|

Therefore, it is shown that in an undirected graph,uevd(u)=2|E|.

03

Show that in an undirected graph,∑uev d(u)=2|E|

(b)

The sum of the edges of the each vertex is an even number, it can be seen that the number of vertices with an odd degree must be an even number.

Consider the solution of the part(a),uevd(u)=2|E|,that shows that the sum of the vertices equal the even number of edges.

Therefore, Using part (a). it has been shown that in an undirected graph, there must be an even number of vertices whose degree is odd.

04

Show that in an undirected graph,∑uev d(u)=2|E|  

(c)

Consider the directed graph that has the indegrees dinand outdegrees dout. The indegree represents the number of incoming edges and the out degree represents the number of the outgoing edges from the vertex.

In the directed graph,

role="math" localid="1658912427821" uevd(u)+dout=2|E|, but the parity of the sum of indegrees cannot be determined.

Therefore a similar statement does not hold for the number of vertices with odd indegree in a directed graph.

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

The police department in the city of Computopia has made all streets one-way. The mayor contends that there is still a way to drive legally from any intersection in the city to any other intersection, but the opposition is not convinced. A computer program is needed to determine whether the mayor is right. However, the city elections are coming up soon, and there is just enough time to run a linear-time algorithm.

a) Formulate this problem graph-theoretically, and explain why it can indeed be solved in linear time.

(b) Suppose it now turns out that the mayor’s original claim is false. She next claims something weaker: if you start driving from town hall, navigating one-way streets, then no matter where you reach, there is always a way to drive legally back to the town hall. Formulate this weaker property as a graph-theoretic problem, and carefully show how it too can be checked in linear time.

Either prove or give a counterexample: if {u,v}is an edge in an undirected graph, and during depth-first search (u)<post (v), then vis an ancestor of uin the DFS tree.

Pouring water.

We have three containers whose sizes are 10 pints, 7 pints, and 4 pints, respectively. The 7-pint and 4-pint containers start out full of water, but the 10-pint container is initially empty. We are allowed one type of operation: pouring the contents of one container into another, stopping only when the source container is empty or the destination container is full. We want to know if there is a sequence of pouring’s that leaves exactly 2 pints in the 7- or 4-pint container.

(a) Model this as a graph problem: give a precise definition of the graph involved and state the specific question about this graph that needs to be answered.

(b) What algorithm should be applied to solve the problem?

(c) Find the answer by applying the algorithm.

Perform depth-first search on each of the following graphs; whenever there’s a choice of vertices, pick the one that is alphabetically first. Classify each edge as a tree edge, forward edge, back edge, or cross edge, and give the pre and post number of each vertex.

Question:Undirected vs. directed connectivity.

(a) Prove that in any connected undirected graph G =(V , E)there is a vertexvV whose removal leaves G connected. (Hint: Consider the DFS search tree for G.)

(b) Give an example of a strongly connected directed graph G(V ,E)such that, for everyvV, removing v from G leaves a directed graph that is not strongly connected.

(c) In an undirected graph with two connected components it is always possible to make the graph connected by adding only one edge. Give an example of a directed graph with two strongly connected components 0 such that no addition of one edge can make the graph strongly connected.

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