retagged by
26,823 views
101 votes
101 votes
Consider an undirected graph $G$ where self-loops are not allowed. The vertex set of $G$ is $\{(i,j) \mid1 \leq i \leq 12, 1 \leq j \leq 12\}$. There is an edge between $(a,b)$ and $(c,d)$ if $|a-c| \leq 1$ and $|b-d| \leq 1$. The number of edges in this graph is______.
retagged by

10 Answers

0 votes
0 votes

There are already some great answers here, just adding my 2 cents on finding the recurrence relation for this question. Let $E_n$ denote number of edges in the given graph with $n$ vertices. Then given a graph with $k-1$ vertices, we can add edges systematically to it to make it a graph with $k$ vertices as follows:

  1. Add $2k-3$ “crosses” (one cross next to each of the $k-2$ crosses already present and one at the corner giving us $2(k-2) + 1=2k-3$)
  2. Add $2(k-1)$ horizontal edges
  3. Add $2(k-1)$ vertical edges

This gives us the recurrence relation : $E_n = E_{n-1} + \underbrace{2(2k-3)}_{\text{crosses}} + \underbrace{2(k-1)}_{\text{horizontal edges}} + \underbrace{2(k-1)}_{\text{vertical edges}}$

 

Below is the visualization when going from graph with 2 vertices to graph with 3 vertices :

graphviz

Notice that in the base case, $E_2=6$

Answer:

Related questions

57 votes
57 votes
11 answers
1
go_editor asked Sep 28, 2014
18,400 views
If $G$ is the forest with $n$ vertices and $k$ connected components, how many edges does $G$ have?$\left\lfloor\frac {n}{k}\right\rfloor$$\left\lceil \frac{n}{k} \right\r...
39 votes
39 votes
9 answers
3
go_editor asked Sep 28, 2014
27,079 views
The maximum number of edges in a bipartite graph on $12$ vertices is____
33 votes
33 votes
9 answers
4
makhdoom ghaya asked Feb 13, 2015
24,605 views
Let G be a connected planar graph with 10 vertices. If the number of edges on each face is three, then the number of edges in G is_______________.