Question

Let U={1,2,3}U = \{1, 2, 3\}. Let 2U2^U denote the powerset of UU. Consider an undirected graph GG whose vertex set is 2U2^U. For any A,B∈2UA, B \in 2^U, (A,B)(A, B) is an edge in GG if and only if (i) A≠BA \neq B, and (ii) either A⊂BA \subset B or B⊂AB \subset A. For any vertex AA in GG, the set of all possible orderings in which the vertices of GG can be visited in a Breadth First Search (BFS) starting from AA is denoted by B(A)\mathcal{B}(A).

If ∅\emptyset denotes the empty set, then the cardinality of B(∅)\mathcal{B}(\emptyset) is _______.

Official answer and solution
Official answer
5040
From
Official GATE 2023 answer key

Solution

Analyze adjacency in the powerset graph GG and count permutations of vertices at distance 1 from ∅\emptyset.

  1. The set U={1,2,3}U = \{1, 2, 3\} has ∣2U∣=23=8|2^U| = 2^3 = 8 subsets.
  2. An edge exists between AA and BB if and only if A≠BA \neq B and either A⊂BA \subset B or B⊂AB \subset A.
  3. Consider the empty set ∅\emptyset:
    For any non-empty subset B∈2U∖{∅}B \in 2^U \setminus \{\emptyset\}, ∅⊂B\emptyset \subset B holds true. Therefore, ∅\emptyset is adjacent to every other vertex in the graph GG.
  4. In a Breadth First Search starting from ∅\emptyset:
    • Level 0 contains only ∅\emptyset (visited first).
    • Level 1 contains all 7 other vertices of GG, because all of them are directly connected to ∅\emptyset by an edge.
  5. Since all 7 remaining vertices are at distance 1 from the start vertex ∅\emptyset, a BFS can visit these 7 vertices in any arbitrary permutation among themselves.
  6. The number of possible BFS vertex orderings is:
    ∣B(∅)∣=7!=5040|\mathcal{B}(\emptyset)| = 7! = 5040
Final answer

5040

Common trap

Assuming vertices are partitioned into levels by subset cardinality (∣S∣=1,2,3|S| = 1, 2, 3), overlooking that ∅⊂S\emptyset \subset S creates direct edges from ∅\emptyset to all subsets regardless of size.

The answer is the one in the official GATE answer key. The solution is this site's own explanation.

Source

Paper
GATE 2023 Computer Science and Information Technology (CS)
Question
56 of 65
Section
Computer Science and Information Technology

Report an error in this question

GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.