• edited by
12,290 views
50 50 votes

Consider a graph whose vertices are points in the plane with integer co-ordinates $(x,y)$ such that $1 \leq x \leq n$ and $1 \leq y \leq n$, where $n \geq 2$ is an integer. Two vertices $(x_1, y_1)$ and $(x_2, y_2)$ are adjacent iff $\mid x_1-x_2 \mid \leq 1 \text { and } \mid y_1 – y_2 \mid \leq 1$. The weight of an edge $\{(x_1, y_1), (x_2, y_2)\} \text{ is } \sqrt{(x_1 – x_2)^2 + (y_1 – y_2)^2}$

  1. What is the weight of a minimum weight-spanning tree in this graph? Write only the answer without any explanations.

  2. What is the weight of a maximum weight-spanning tree in this graph? Write only the answer without any explanations.

4 Answers

Best answer
86 86 votes

Consider $n=3$, we have $9$ vertices in the plane. The vertices are:

$(1,1),\quad(1,2),\quad (1,3), \quad (2,1),\quad    (2,2),\quad (2,3),\quad (3,1),\quad (3,2),\quad (3,3)$ 

So, the corresponding graph will be:

Minimum spanning tree:

(One of the possibilities)

There is no problem with a minimum spanning tree. We have $n^{2}$ vertices, so the minimum spanning tree contains $n^{2}- 1$ edges of cost $1$. So, the cost of the minimum spanning tree is $n^{2}-1$.

Maximum spanning tree:

In this maximum spanning tree of $n^{2}$ $-$$ 1$ edges , $n^{2}$ $-$$ 2$ edges are of cost ${\sqrt{2}}$ and $1$ edge is of cost $1$.

So, the answer is ${\sqrt{2}}$ $\left ( n{^{2}}-2 \right )+1$.

This pattern continues for high values of $n.$

For $n=4$, the maximum spanning tree is:

(one of possibilities)

For $n=4$ ,   $16$  vertices are there and the maximum spanning tree requires $15$ edges. Out of $15$ edges, $14$ edges are of cost ${\sqrt{2}}$ and $1$ edge is of cost $1$. Thus satisfying the formula ${\sqrt{2}}$ $\left ( n{^{2}}-2 \right )$ $+1$.

The cost of Minimum spanning tree is: $n^{2}-1$.

The cost of Maximum spanning tree is: $\left ( n^{2}-2 \right )\sqrt{2}+1$.

• edited by
12 12 votes

Most of people have given correct answer for part A and B.

Just to provide another way of thinking, adding some explanation for Part B.

                   (3) Now if you will observe $D_1$ is connecting  odd number diagonal  and $D_2$ is connecting even number diagonal. We need one more max distance link to connect them ($D_1$ and $D_2$). So final answer is $\sqrt{2}*({n}^2-2)+1$

• edited by
11 11 votes

A.  In the graph start applying Kruskal algorithm. So, we select all edges of cost $1$ first. 

For each $y = i$, there will be $n-1$ unit length path. Total cost = $n(n-1)$ 

Then we can join these $n$ lines by one vertical line whose length is $n-1$.

Total:
$$n(n-1) + (n-1) = (n-1)\cdot (n+1) = n^2 -1$$


B. We can apply Kruskal's algorithm by taking maximum weight edge (ref). Maximum weight edge here is $\sqrt 2$ as we are taking Euclidean distance as mentioned in question. 

All diagonals will sum to:
$$\sqrt{2} (n-1) +2 \Bigl ( \sqrt{2} (n-2) + \sqrt{2} (n-3)+ \dots + \sqrt{2} \Bigr ) \\= \sqrt{2} (n-1) +\sqrt{2}. (n-1). (n-2) \\= \sqrt{2}. (n-1)^2$$
(One main diagonal and $(n-1)$ diagonals on either side of it).

Now, we can no more add any edge of weight $\sqrt 2$  without forming a cycle. 

So, we take $2(n-1)$ edges of weight $1$ to interconnect these diagonals

$= \sqrt{2} (n -1)^2 + 2(n-1) \\= \sqrt{2} \cdot (n-1) \cdot (n-1+\sqrt 2)$

• edited by
Position:
Show:

Related questions

21 21 votes
2 answers 2 answers
6.8k
6.8k views
go_editor asked Feb 8, 2018
6,807 views
Consider the following relational database schema:EMP (eno name, age)PROJ (pno name)INVOLVED (eno, pno)EMP contains information about employees. PROJ about projects and i...
53 53 votes
6 answers 6 answers
13.9k
13.9k views
go_editor asked Oct 14, 2015
13,878 views
An operating system handles requests to resources as follows.A process (which asks for some resources, uses them for some time and then exits the system) is assigned a un...
21 21 votes
1 answers 1 answer
5.7k
5.7k views
go_editor asked Oct 14, 2015
5,677 views
Following floating point number format is given$f$ is a fraction represented by a $6-bit$ mantissa (includes sign bit) in sign magnitude form, $e$ is a $4-bit$ exponent (...
5 5 votes
1 1 answer
2.0k
2.0k views
Kathleen asked Sep 29, 2014
1,970 views
The language $L,$ defined by the following grammar, allows use of real or integer data in expressions and assignment statements.<assign-stmt :: <LHS := <E <E ::...