Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7404595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T05:16:37+00:00 2026-05-29T05:16:37+00:00

I am at learning stage of cyclomatic complexity(CC). For practise, I am calculating cyclomatic

  • 0

I am at learning stage of cyclomatic complexity(CC). For practise, I am calculating cyclomatic complexity of 2 examples and want to confirm if my answers are correct or not…

Referring to wikipedia, CC is given by M = E − N + 2P where:

  • E = the number of edges of the graph
  • N = the number of nodes of the graph
  • P = the number of connected components

Please help.

Example 1

Here, E = 8, N = 9 and P = 1. Hence M = 8 – 9 + (2×1) = 1.

Example 2:

Example 2

Here E = 11, N = 10 and P = 1. Hence M = 10 – 11 + (2×1) = 1.

Hence for both the examples CC is 1. Please let me know if my calculation is correct or not.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T05:16:38+00:00Added an answer on May 29, 2026 at 5:16 am

    You need to take more care to correctly insert the values into the formula.

    In example 1, you say

    Here, E = 8, N = 9 and P = 1

    But actually, it’s the other way round: 9 edges (=E), 8 nodes (=N), so you get a CC of 3.

    In example 2, you have the values right: E=11, N=10, P=1. But you insert them in the wrong order in the formula; it actually should be 11 - 10 + (2x1) = 3.

    Shortcut: If you have a picture of your graph, you can very easily determine the cyclomatic complexity. Just count the number of regions the background is divided into by the edges. In your first example, you have 2 inner regions (bordered by the edges) and one surrounding region, giving a CC of 3. Same goes with the second example. (This method requires that edges are not crossing each other, obviously.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm on the stage of learning java, and I have the following question. On
I'm still in the beginning stage of learning c#, so i have a question
I am in learning stage in android and my application requirement is to draw
I`m still in a learning stage with spring transactions and aop, and i have
Hi all as i in learning stage of django so support me. I have
I'm on the learning stage, and i need some feedback for the code I've
I'm on the stage of learning cakephp, which is a OO based framework, but
I'm on the stage of learning OOP with the help of PHP and David
After learning of this excellent method of accessing an object placed on the stage
I'm still at the learning stage of c# so don't shoot me if you

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.