A flow graph 𝐹 with entry node (1) and exit node (11) is shown below: How…

2019

A flow graph 𝐹 with entry node (1) and exit node (11) is shown below:

How many regions are there in flowgraph 𝐹?

  1. A.

    2

  2. B.

    3

  3. C.

    4

  4. D.

    5

Attempted by 78 students.

Show answer & explanation

Correct answer: C

Key idea: the number of regions in a connected flow graph equals its cyclomatic complexity M.

Formula:

  • M = E - N + 2 (for a single connected component)

Step 1: Count the nodes (N).

  • All numbered nodes from the diagram: 1 through 11, so N = 11.

Step 2: Count the edges (E). List each directed edge shown in the diagram:

  • 1 -> 2

  • 2 -> 3

  • 3 -> 6

  • 3 -> 4

  • 4 -> 5

  • 5 -> 10

  • 6 -> 7

  • 6 -> 8

  • 7 -> 9

  • 8 -> 9

  • 9 -> 10

  • 10 -> 1

  • 1 -> 11

Counting the listed edges gives E = 13.

Step 3: Apply the formula.

  • M = E - N + 2 = 13 - 11 + 2 = 4

Conclusion: The flowgraph has 4 regions.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Mppsc Assistant Professor