/*! This file is auto-generated */ .wp-block-button__link{color:#fff;background-color:#32373c;border-radius:9999px;box-shadow:none;text-decoration:none;padding:calc(.667em + 2px) calc(1.333em + 2px);font-size:1.125em}.wp-block-file__button{background:#32373c;color:#fff;text-decoration:none} Q12E Either prove or give a counterex... [FREE SOLUTION] | 91Ó°ÊÓ

91Ó°ÊÓ

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.

Short Answer

Expert verified

If {u,v} is an edge in an undirected graph, and during the depth-first search post (u) < post(v) , then v is an ancestor of u in the DFS tree.

Step by step solution

01

Depth-first search

Depth First Search (DFS) is an application of graph traversal. It traverses the node downwards and uses the stack as a data structure through this it traverses all vertices in the downward direction one by one.

Some properties ofdepth-first search are as follows:

  1. Using DFT we can verify whether the graph is connected or not it means it detects the cycle present in the graph or not.
  2. We can find out the number of connected components by using adepth-first search.
  3. Here we are using the stack as a data structure.

The time complexity of the list is O(V+E).

The time complexity of matrix isOV2.

It contains various edges, they aretree edge, forward edge, back edge, or cross edge all the edges are explained below:

Tree edge: The graph obtained by traversing while using a depth-first search is called its tree edge.

Forward edge: the edge {u,v} whereis a descendant and it is not part of the depth-first search is called the forward edge.

Back edge: the edge {u,v} where is the ancestor and it is not part of the depth-first search is called the back edge.

02

Step 2: During DFS,post (u) < (v) , and v is an ancestor of u in the DFS tree

Consider the depth first search tree of graph G starting at any vertex. For this graph, if depth-first search is performed in the graph then if post is less than post v than, here the edge {u,v} where u is ancestor and it is not part of depth first search is called back edge. If {u,v} is an edge in an undirected graph and while performing a depth-first search in the undirected connected graph the the post (u)< post (v) , then v is an ancestor of in the DFS tree.

Here it follows these two conditions:

  1. [preu,post u] [prev.post v ]
  2. [prev,[preu,post u]post v ]

Only these options are taking place here for an undirected graph post u is less than post v. since there is an edge between these two vertices and option one is not possible because it is a must to traverse all the neighbors of a vertex before marking it as visited.

So, option two’s condition is only possible which defines the vertex v is the ancestor of u. hence an undirected graph, and during the depth-first search, post(u) < post (v),then v is an ancestor of u in the depth-first search traversal.

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 91Ó°ÊÓ!

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

Question:Undirected vs. directed connectivity.

(a) Prove that in any connected undirected graph G =(V , E)there is a vertexv∈V 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 everyv∈V, 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.

Give an efficient algorithm that takes as input a directed acyclic graph G=V,E, and two vertices s,t∈V, and outputs the number of different directed paths from S to t in G.

In an undirected graph, the degree d(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 indegree din(u), which is the number of edges into u, and the outdegree dout(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?

A bipartite graph is a graph G=(V,E)whose vertices can be partitioned into two sets (V=V1V2andV1V2=Ï•) such that there are no edges between vertices in the same set (for instance, if , then there is no edge between and ).

(a) Give a linear-time algorithm to determine whether an undirected graph is bipartite.

(b) There are many other ways to formulate this property. For instance, an undirected graph is bipartite if and only if it can be colored with just two colors. Prove the following formulation:

an undirected graph is bipartite if and only if it contains no cycles of odd length.

(c) At most how many colors are needed to color in an undirected graph with exactly one odd length?

For each node in an undirected graph, let twodegreeube the sum of the degrees of’s neighbors. Show how to compute the entire array of two degree. values in linear time, given a graph in adjacency list format

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.