UGC-NET Dec 2011 · Introduction to Graph Theory

MCQ · 2 marks · Problem PROG-GRPH-0023

McCabe’s cyclomatic metric $V(G)$ of a graph $G$ with $n$ vertices, $e$ edges and $p$ connected component is
  1. A
    $e$
  2. B
    $n$
  3. C
    $e – n + p$
  4. D
    $e – n + 2p$

Solve it on GATE DA practice →More Graph Theory & Algorithms problems

Show the worked solution\[\boxed{V(G)=e-n+2p}\]For a single connected flow graph (\(p=1\)) this is the familiar \(e-n+2\). With \(p\) components (e.g. a main program and its subroutines), each component contributes \(e_k-n_k+2\), and summing gives \(e-n+2p\).Answer: D

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com