To show that any tree is 2-colorable.
Explanation of Solution
Given Information:
A of an undirected graph is a function such that for every edge
Explanation:
There are no loops in tree, if a color (0) is given to a node, then all its neighbors should be colored with a different color say color (1). Now color the neighbors of all these neighbors with color (0). In this way keep coloring alternating colors until the whole tree is colored. Since there are no loops no node will be visited and thus colored twice. In the end any path in the tree has vertices with alternating colors.
To show that the following are equivalent:
- G is bipartite.
- G is 2-colorable.
- G has no cycles of odd length.
Explanation of Solution
A bipartite graph has two sets of vertices which has equal number of vertices in those two sets. So, if the given graph G is bipartite that means it will be 2 colorable because one set of vertices can be colored with one color say color (0) and another set of vertices can be colored with another set of vertices say color (1).
The following figure shows the bipartite graph with chromatic number
Also, it can be seen that it has no cycles of odd length from the above figure of bipartite graph.
So, on the basis of above illustration- the following points can be made-
- G is bipartite.
- G is 2-colorable.
- G has no cycles of odd length.
To prove that a Graph can be colored with colors where is the maximum degree of any vertex in graph.
Explanation of Solution
Greedy coloring procedure requires us to number the colorsthat are used. So, each time a new color is introduced it is numbered.
Greedy coloring
If the maximum degree vertex of a graph has degree d, let this vertex be v.
Color v with color 1.
Since all the adjacent vertices of 'v' have to be colored with a color other than color of 'v', let us assume that all the adjacent vertices are colored with different colors.
As number of neighbors is d, hence number of additional colors required is d. So, maximum d+1 colors are needed.
This is the maximum number of colors needed because in no case there will be more than d+1 colorsas the maximum degree is d. (All the neighbors and other nodes of graph have degree <= d)
Proof by mathematical induction:
Base case: A graph with just 1 vertex has maximum degree 0 and needs only 1 color. It is 1-colorable.
Inductive hypothesis: It can be assumed that any graph which has = k vertices and maximum vertex degree = d can be colored with d+1 colors.
Inductive Step: Now suppose there is a graph G with k+1 vertices and maximum degree d. Remove a vertex v (and all its edges) from G to create a smaller graph G'.
The maximum degree of G' is not greater than d, because removing a vertex from G' won't increase its degree. So, by the inductive hypothesis, G' can be colored with d + 1 colors. The neighbors of v are only using d of the available colors because v has maximum d neighbors, leaving a spare color that can be assigned to v.
Therefore, the coloring of G is an extension of coloring of G'. Hence, G can be colored with d+1 colors. G is (d+1)-colorable.
To show that a graph G can be colored with if it has edges.
Explanation of Solution
Run the above greedy algorithm when a coloris used for the first time, to color a vetexmark the edges joining to vertices already coloured which is atleast
Every marked edge is marked only once during the process and at least edges will be marked when number of colors are used. So if number of colors are present, then number of edges will be colored.
Want to see more full solutions like this?
Chapter B Solutions
Introduction to Algorithms
- A network is considered to be biconnected if every pair of its vertices is linked by two distinct paths. A vertex that, if it and its surrounding edges were removed, would result in the graph becoming unconnected is known as an articulation point in a linked network. show any graph without articulation points that it is biconnected. Use the fact that none of the vertices on the path is an articulation point to construct two disjoint paths connecting s and t given a set of vertices s and t and a path connecting them.arrow_forwardComputer Science Frequently, a planar graph G=(V,E) is represented in the edgelist form, which for each vertex vi V contains the list of its incident edges, arranged in the order in which they appear as one proceeds counterclockwise around i v . Show that the edge-list representation of G can be transformed to the DCEL (DoublyConnected-Edge-List) representation in time O(|V|).arrow_forwardLet G be a connected graph with n vertices and m edges.Which of the following statements are true?(i) G is a tree if and only if n = m+1.(ii) G is a tree if and only if m = n+1.(iii) G is a tree if and only if the addition of any edgeto G will produce a unique cycle.(iv) G is a tree if and only if G contains at least onepath b etween any two vertices.(v) If G is connected, then G is a tree if and only if Gcontains at most one path between any two vertices.(vi) A connected subgraph of a tree is always a tree.arrow_forward
- Given a graph that is a tree (connected and acyclic). (I) Pick any vertex v.(II) Compute the shortest path from v to every other vertex. Let w be the vertex with the largest shortest path distance.(III) Compute the shortest path from w to every other vertex. Let x be the vertex with the largest shortest path distance. Consider the path p from w to x. Which of the following are truea. p is the longest path in the graphb. p is the shortest path in the graphc. p can be calculated in time linear in the number of edges/verticesarrow_forwardConsider a set of real number pairs that represent a collection of V intervals on the real line. An interval graph with one vertex for each interval is defined by such a collection, with edges connecting vertices in the event that the associated intervals cross (have any points in common). Create a programme that creates V random intervals, each of length d, in the unit interval and then creates the interval graph that goes with it.Use a BST, as a tip.arrow_forwardWe recollect that Kruskal's Algorithm is used to find the minimum spanning tree in a weighted graph. Given a weighted undirected graph G = (V , E, W), with n vertices/nodes, the algorithm will first sort the edges in E according to their weights. It will then select (n-1) edges with smallest weights that do not form a cycle. (A cycle in a graph is a path along the edges of a graph that starts at a node and ends at the same node after visiting at least one other node and not traversing any of the edges more than once.) Use Kruskal's Algorithm to nd the weight of the minimum spanning tree for the following graph.arrow_forward
- Discrete mathematics. Let G = (V, E) be a simple graph4 with n = |V| vertices, and let A be its adjacency matrix of dimension n × n. We want to count the L-cycles : such a cycle, denoted by C = u0u1 · · · uL with uL = u0 contains L distinct vertices u0, . . . , uL-1 et L edges E(C) = {uiui+1 | 0 ≤ i ≤ L − 1} ⊆ E. Two cycles are distinct if the edge sets are different : C = C' if and only if E(C) = E(C'). We define the matrices D, T, Q, the powers of A by matrix multiplication : D = A · A = A2, T = A · D = A3, Q = A · T = A4. Consider the values on the diagonals. Prove that the number of 3-cycles N3 in the whole graph is N3 = 1/6 ∑ u∈V Tu,uarrow_forwardDiscrete mathematics. Let G = (V, E) be a simple graph4 with n = |V| vertices, and let A be its adjacency matrix of dimension n × n. We want to count the L-cycles : such a cycle, denoted by C = u0u1 · · · uL with uL = u0 contains L distinct vertices u0, . . . , uL-1 et L edges E(C) = {uiui+1 | 0 ≤ i ≤ L − 1} ⊆ E. Two cycles are distinct if the edge sets are different : C = C' if and only if E(C) = E(C'). We define the matrices D, T, Q, the powers of A by matrix multiplication : D = A · A = A2, T = A · D = A3, Q = A · T = A4. Consider the values on the diagonals. Prove that for any vertex u ∈ V with degree d(u), d(u) = Du,u.arrow_forwardSuppose that G is an unconnected graph that consists of 4 connected components. The first component is K4, the second is K2,2, the third is C4 and the fourth is a single vertex. Your job is to show how to add edges to G so that the graph has an Euler tour. Justify that your solution is the minimum number of edges added.arrow_forward
- A path of length two is denoted by P2. If a graph G does not contain P2 as induced subgraph, then: 1- G must be a clique (i.e., a complete graph). 2- Every vertex of G must of degree one. 3- Every connected component of G must be a clique. 4- Every connected component of G must consist of at most two vertices.arrow_forwardThe reverse of a directed graph G = (V, E) is another directed graph GR = (V, ER) on the same vertex set, but with all edges reversed; that is, ER = {(v, u) where (u, v) belongs to E}. Give an algorithm for computing the reverse of a graph in adjacency list format. You may assume that the vertices are integers 1 to N. Specify its space and time complexity.arrow_forwardLet G = (V, E) be a graph with vertex-set V = {1, 2, 3, 4, 5} and edge-set E = {(1, 2), (3, 2), (4, 3), (1, 4), (2, 4), (1, 3)}. (a) Draw the graph. Find (b) maximal degree, i.e. ∆(G), (c) minimal degree, i.e. δ(G), (d) the size of biggest clique, i.e. ω(G),(e) the size of biggest independent set, i.e. α(G), ter(f) the minimal number of colours needed to color the graph, i.e. χ(G).arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education