Log In
44 votes

Let $G_1=(V,E_1)$ and $G_2 =(V,E_2)$ be connected graphs on the same vertex set $V$ with more than two vertices. If $G_1 \cap G_2= (V,E_1\cap E_2)$  is not a connected graph, then the graph $G_1\cup G_2=(V,E_1\cup E_2)$

  1. cannot have a cut vertex
  2. must have a cycle
  3. must have a cut-edge (bridge)
  4. has chromatic number strictly greater than those of $G_1$ and $G_2$
in Algorithms
edited by
Refere This question, if you are not able to interpret this image.
yes it is good link
I am not getting what he is trying to say. Can you explain a bit?

G1∩G2=(V,E1∩E2)  is not a connected graph,

wht does it mean

Why we are not taking directed graph here? Will there also be a cycle then?

10 Answers

50 votes
Best answer

Take a tree for example 

  1. False. Every vertex of tree (other than leaves) is a cut vertex.
  2. True.
  3. False. There is no cut-edge (an edge whose removal increases the number of connected components in  graph) in $G_1 \cup G_2.$
  4. False. $G_1 \cup G_2$, $G_1$ and $G_2-$ all three graphs have same the chromatic number of $2$. 

Now, we have given counter examples for options A,C and D. So, option B is the only possible answer and its proof is given at end.

Correct Answer: Option B

We are given that $G_1$ and $G_2$ are connected. So, if we take any two vertices say $v_i$ and $v_j$ there must be path between them in both $G_1$ and $G_2.$ Now, it is given that $G_1\cap G_2$ is disconnected. That is, we have at least two vertices $v_1$ and $v_2$ such that there is no path between them in $G_1 \cap G_2.$

This means the path between $v_1$ and $v_2$ in $G_1$ and $G_2$ are distinct

When we have two distinct paths between a pair of vertices in a graph, it forms a cycle.

selected by

G1 and G2 are connected graph. As G1 $\cap$ G2 is disconnected graph, there must exist two vertices say V1 and V2 such that there is no path between them in G1 $\cap$ G2.

But as G1 is connected graph it must have some path P1 between vertices V1 and V2. Similarly, G2 must have some path P2 between V1 and V2.

Now, these P1 and P2 are not the same paths, if they are they will be present in G1 $\cap$ G2, which will contradict with our assumption.

In G1 $\cup$ G2, we have two paths P1 and P2 to between V1 and V2. That form the cycle. See the image.

@srestha but G1 intersection G2 is connected but should be not connected as specified in question.

Correct me if m wrong.

See the node D, if you try to take intersection of G1 and G2, D will be disconnected as the path is not common in G1 and G2.


G1 intersection G2 is disconnected or not?

I found that we have a common path in both G1 and G2 ,which is connected.

what actually G1 and G2 intersection is?


in question they said consider more then 2 vertices !



your 1st option explanation does not follow the question, you said G1 and G2 is tree so it must have a cut vertex but it was talking about (G1 intersect G2) which does not have any cut vertex in your given example...

Great explaination!
30 votes

Say G1 is Black colored graph, and G2 is red colored graph.
In this figure i overlapped both graphs, to see them together.

Given that $G_1 \cap G_2 $ is Disconnected, To make it happen G1 and G2 has to meet somewhere and then leave at some point, Once they leave each other and then have to meet somewhere again to have atleast two different disconnected component.
Now it is clear that this will form a cycle (See image has cycle.)

Note: If  $G_1 \cap G_2 $ need not to be disconnected then $G_1\cup G_2 $ need not to have a cycle.

(in this case when one of the Graph has cycles then only $G_1\cup G_2$ can have cycle.)

amazing explanation!!
10 votes
A very simple reasoning in this question may fetch the answer very fast. Since the two graphs G1 and G2 are connected, there will be path from a vertex to every other vertex in  both G1 and G2 but since G1 ∩ G2 is not connected , at least for one vertex pair v1,v2 the connecting paths must be different in both G1 and G2. Hence G1 union G2 will definitely have a cycle.
5 votes

There would be "at least " one cycle there in G1 Union G2

you should also proof ,do they have cut vertex??,i think no by seeing your examples
2 votes
Question is indirectly saying in $G_1$ U $G_2$ we have edge disjoin path between some vertices because  $G_1$ ∩  $G_2$ is disconnected (means at least two vertices could reach each other via edge disjoint path ). So option (B) is True in all the cases.
1 vote
As G1 and G2 are connected, let us say one vertex is V,now there is a way from V to all other vertices in both G1 and G2,but as their intersection  is disconnected,means there are some edges which are in G1 but not in G2 and vice versa.Or we can say there is atleast one from V to V' which is different in both G1 and G2 because if for all vertices it is same path from V to all other vertices then it will not give disconnected graph as intersection.

Now whn union will be done then their will be two paths from V to V' (one of G and other of G1) and then it will form a cycle.
0 votes

Option B is correct.

In this example above there is cut vertex E is present so option A is false,

there is no cut edge so option C is false and

not necessarily chromatic number will be greater, it can be equal.  so option D is also false.

0 votes


This can also be a approach to the solution.

Just that handwriting is not good :p
0 votes


Since there are two connected graphs G1 and G2 for the same set of vertices.

Now, G1 intersection G2 is disconnected means G1 and G2 must have at least one different path between two vertices.

So, for that pair of vertex cycle is formed

0 votes

The diagram can easily be deduced.

1st in the graphs, there will not be a single cut vertex, but multiple

2nd There will definitely be a cycle

3rd there will not be a single cut edge but multiple

4th the chromatic number of the union graph can be equal or greater than the chromatic number of the single graphs.

Hence option B is most suited


Related questions

27 votes
3 answers
Suppose we run Dijkstra’s single source shortest path algorithm on the following edge-weighted directed graph with vertex $P$ as the source. In what order do the nodes get included into the set of vertices for which the shortest path distances are finalized? $P,Q,R,S,T,U$ $P,Q,R,U,S,T$ $P,Q,R,U,T,S$ $P,Q,T,R,U,S$
asked Sep 19, 2014 in Algorithms Kathleen 6.2k views
33 votes
7 answers
The recurrence equation $ T(1) = 1$ $T(n) = 2T(n-1) + n, n \geq 2$ evaluates to $2^{n+1} - n - 2$ $2^n - n$ $2^{n+1} - 2n - 2$ $2^n + n $
asked Sep 19, 2014 in Algorithms Kathleen 9.6k views
22 votes
6 answers
The time complexity of the following C function is (assume $n > 0$) int recursive (int n) { if(n == 1) return (1); else return (recursive (n-1) + recursive (n-1)); } $O(n)$ $O(n \log n)$ $O(n^2)$ $O(2^n)$
asked Sep 19, 2014 in Algorithms Kathleen 11.3k views
51 votes
13 answers
Let $A[1,\ldots,n]$ be an array storing a bit ($1$ or $0$) at each location, and $f(m)$ is a function whose time complexity is $\Theta(m)$. Consider the following program fragment written in a C like language: counter = 0; for (i=1; i<=n; i++) { if (a[i] == 1) counter++; ... = 0;} } The complexity of this program fragment is $\Omega(n^2)$ $\Omega (n\log n) \text{ and } O(n^2)$ $\Theta(n)$ $o(n)$
asked Sep 19, 2014 in Algorithms Kathleen 12.3k views