title: Calculation of Cyclomatic Complexity
body: <p>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... </p>
  
  <p>Referring to wikipedia, CC is given by <code>M = E − N + 2P</code> where:</p>
  
  <ul>
  <li>E = the number of edges of the graph</li>
  <li>N = the number of nodes of the graph</li>
  <li>P = the number of connected components</li>
  </ul>
  
  <p>Please help.</p>
  
  <p><img src="https://i.stack.imgur.com/2FbHb.jpg" alt="Example 1"></p>
  
  <p>Here, E = 8, N = 9 and P = 1. Hence M = 8 - 9 + (2x1) = 1.</p>
  
  <p>Example 2:</p>
  
  <p><img src="https://i.stack.imgur.com/e3ana.jpg" alt="Example 2"></p>
  
  <p>Here E = 11, N = 10 and P = 1. Hence M = 10 - 11 + (2x1) = 1.</p>
  
  <p>Hence for both the examples CC is 1. Please let me know if my calculation is correct or not.</p>