Software Engineering - cyclomatic complexity

Click For Summary

Discussion Overview

The discussion revolves around the concept of cyclomatic complexity in software engineering, specifically focusing on constructing flow graphs and determining the number of paths within those graphs. Participants are addressing a homework problem that involves analyzing a flow diagram and its associated complexities.

Discussion Character

  • Homework-related, Technical explanation, Debate/contested

Main Points Raised

  • One participant expresses confusion about constructing the flow graph, particularly regarding an if statement after a process.
  • Another participant points out a mistake in the flow diagram related to the execution conditions of a process within a while loop.
  • A different participant questions the count of paths in the flow graph, suggesting there are 8 paths instead of the expected 7, and seeks clarification on this discrepancy.
  • Some participants suggest checking examples from textbooks to verify the path counting method.
  • There is a suggestion to adjust the flow diagram by moving an arrow, although one participant believes this change may not significantly impact the overall understanding.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the correct number of paths in the flow graph, with some asserting there are 8 while others suggest there should be 7. The discussion remains unresolved regarding the exact count and correctness of the flow diagram.

Contextual Notes

Participants reference specific conditions and processes within the flow graph that may depend on interpretations of the diagram. There are also mentions of potential errors in the flow diagram that have not been definitively resolved.

ming2194
Messages
31
Reaction score
0

Homework Statement


[PLAIN]http://img17.imageshack.us/img17/651/cyclomaticcomplexity.png

Homework Equations


Main problem on part (i), am i correct on constructing the flow graph?
The If statement after process x makes me quite confused.

The Attempt at a Solution


[PLAIN]http://img141.imageshack.us/img141/5377/attempt2009ppc3page2.png
[PLAIN]http://img714.imageshack.us/img714/4234/attempt2009ppc3page3.png
 
Last edited by a moderator:
Physics news on Phys.org
The image of your solution is too large: 1654 x 2339 pixels. Please shrink it to about 600 x 800 and repost.
 
ok now. Thanks
 
Much better. Now I can see it without having to scroll up-down and left-right. You have a mistake on the if statement inside the while loop. Process q executes if either or both of the following is true:
1. condition d is true AND condition f is true
2. condition e is true

In your flow diagram you are saying that if d is true and f is false, q executes. That is incorrect.

There's another thing I would change -- I would move the arrow going from "a" to "end if" so that it goes to "end mymodule".
 
[PLAIN]http://img822.imageshack.us/img822/1746/image001zqp.jpg
Is this time correct?

(ii) Cyclomatic Complexity = 7, since there are 7 regions in the whole flow graph.

(iii) 8 paths?
1. n-end if-end mymodule
2. n-m-end if-end mymodule
3. n-m-t-a-end if-end mymodule
4. n-m-t-a-x-d-e-q-k-a-end if-end mymodule
5. n-m-t-a-x-d-e-q-k-a-end if-end mymodule
6. n-m-t-a-x-d-f-q-k-a-end if-end mymodule
7. n-m-t-a-x-d-f-e-q-k-a-end if-end mymodule
8. n-m-t-a-x-d-f-e-k-a-end if-end mymodule

**Why I found there are 8 paths?! Not support to be 7 paths only?!

Hope you can help me to check patiently since I m going to face this type of question in the coming up exam and I don't want to lose any marks...

And for your last statement, what you suggest to me?
 
Last edited by a moderator:
I don't see anything wrong in your flow diagram now. As far as how many paths, and whether there should be 7 or 8, I don't know. The best thing to do is count them, I think. If your book has any examples, take a look at them and see whether you are doing the same thing.

Regarding my comment about moving the arrow from a to end-if so that it points to end-mymodule, I don't think it matters much either way.
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 7 ·
Replies
7
Views
4K
  • · Replies 40 ·
2
Replies
40
Views
8K
Replies
1
Views
4K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
5K
  • · Replies 15 ·
Replies
15
Views
5K
Replies
9
Views
3K
  • · Replies 53 ·
2
Replies
53
Views
8K