• S
    SwaseekhGATE Preparation
General
  • Dashboard
  • Syllabus
  • Questions
  • Aptitude
  • Mock Tests
  • TCS NQT 2026
Account
  • Pricing
  • Contact
  1. GATE CS
  2. PYQs
  3. Discrete Mathematics

Write the adjacency matrix representation of the graph given in the figure. The graph has four vertices P1, P2, P3, P4 with edges P1-P2, P1-P3, P2-P4, and P3-P4 (a 4-cycle).

GATE 1988 · Discrete Mathematics · Graph Connectivity · medium

Answer: Adjacency matrix: Row P1=[0,1,1,0]; Row P2=[1,0,0,1]; Row P3=[1,0,0,1]; Row P4=[0,1,1,0].

  1. Identify edges from the figure: Edges: P1-P2, P1-P3, P2-P4, P3-P4. Non-zero off-diagonal cells: (1,2),(2,1),(1,3),(3,1),(2,4),(4,2),(3,4),(4,3).
  2. Fill the adjacency matrix: A = [[0,1,1,0],[1,0,0,1],[1,0,0,1],[0,1,1,0]]. Row P1=[0,1,1,0]; Row P2=[1,0,0,1]; Row P3=[1,0,0,1]; Row P4=[0,1,1,0].