0 views

Uploaded by ATS

Cyclomatic complexity is software metric used in software developments as White box testing and structural testing. The purpose of the paper is to describe the Use and Analysis on Cyclomatic complexity in Software development with an example. The Cyclomatic complexity is computed using the flow graph of the program: the nodes of the graph correspond to one or more code statement and the edges connect two nodes. Based on the flow graph how to find Cyclomatic complexity is described here

- 03_TOS
- testing-sw-concept-1200317215102236-3
- IJCER (www.ijceronline.com) International Journal of computational Engineering research
- fgrid
- sinamics
- The Ring programming language version 1.3 book - Part 67 of 88
- Assignment for Week3
- Embedded
- Replicated Configurations
- Angle Debug
- Integration Testing
- computer engineering
- ahblit
- Tutorial c for Avr
- ICT 22(6)
- 10.1.1.62
- Compiler Design
- Project Code
- System Approach
- Time Table

You are on page 1of 4

Development

Chandrakant R. Gujar Dr. Suryakanta R. Ajmera

Assistant Professor, MCA WKBS Mandals

MCA WKBS Mandals MCA College for Women’s

MCA College for Women’s Deopur Dhule, Maharashtra, India

Deopur Dhule, Maharashtra, India

Abstract: Cyclomatic complexity is software metric used in software developments as White box testing and structural

testing. The purpose of the paper is to describe the Use and Analysis on Cyclomatic complexity in Software development

with an example. The Cyclomatic complexity is computed using the flow graph of the program: the nodes of the graph

correspond to one or more code statement and the edges connect two nodes. Based on the flow graph how to find

Cyclomatic complexity is described here.

Keywords: Cyclomatic Complexity, Flow graph, Predicate node, connected components, developers, testers.

1. INTRODUCTION

Cyclomatic complexity is software metric (measurement). It

was developed by Thomas J. McCabe, Sr. in 1976 and is used

to indicate the complexity of a program. It is a quantitative

measure of the complexity of programming instructions. It

directly measures the number of linearly independent paths

through a program’s source code. It is one of the metric based

on not program size but more on information/control flow.

quantitative measures of logical complexity of a program.

The Cyclomatic complexity of a section of source code is the

count of the number of linearly independent paths through the

source code. For instance, if the source code contained no Flow Graph notation for a program is defines. Several nodes

decision points such as IF through the code. If the code had a connected through the edges. Below are Flow diagrams for

single IF statement containing a single condition, there would statements like if-else, While, until and normal sequence of

be two paths through the code: one path where the IF flow. fig.2 Reference [1]

statement is evaluated as TRUE and one path where the IF

statement is evaluated as FALSE.

the complexity of a program. These metric, measures

independent paths through program source code. Independent

path is defined as a path that has at least one edge which has

not been traversed before in any other paths. Cyclomatic

complexity can be calculated with respect to functions,

modules, methods or classes within a program.

it is based on a control flow representation of the program.

Control flow depicts a program as a graph which consists of

Nodes and Edges.

represent control flow between the nodes. fig 1 [1]

www.ijcat.com 153

International Journal of Computer Applications Technology and Research

Volume 8–Issue 05, 153-156, 2019, ISSN:-2319–8656

Complexity? . V(G) = 9 - 7 + 2 = 4

The Cyclomatic Complexity is computed in one of five ways: V(G) = 3 + 1 = 4 (Condition nodes are 1,2 and 3

The number of regions of the flow graph nodes)

corresponds to the Cyclomatic complexity. Basis Set - A set of possible execution path of a

The Cyclomatic complexity, V(G), for a graph G is program

defined as V(G) = E – N + 2 1, 7

Where E is the number of flow graph edges and N is 1, 2, 6, 1, 7

the number of flow graph nodes. 1, 2, 3, 4, 5, 2, 6, 1, 7

The Cyclomatic complexity, V(G), for a graph G is 1, 2, 3, 5, 2, 6, 1, 7

defined as V(G) = E – N + 2P

Where E is the number of flow graph edges, N is the

number of flow graph nodes and P is connected 2. PROPERTIES OF CYCLOMATIC

components.

The Cyclomatic complexity, V(G), for a graph G is COMPLEXITY:

also defined as V(G) = P + 1

Where P is the number of predicate nodes contained Following are the properties of Cyclomatic complexity:

in the flow graph G. The predicate node is a node

that has of out degree two i.e. Binary node.

1. V (G) is the maximum number of independent paths

The Cyclomatic complexity, V (G), for a graph G is in the graph

also defined as total number of independent path of 2. V (G) >=1

flow graph. 3. G will have one path if V (G) = 1

4. Minimize complexity to 10

For Example:

2.1 How this metric is useful for software

i = 0;

testing?

n=4; //N-Number of nodes present in the graph

while (i<n-1) do Basis Path testing is one of White box technique and it

guarantees to execute at least one statement during testing. It

j = i + 1;

checks each linearly independent path through the program,

while (j<n) do which means number test cases, will be equivalent to the

if A[i]<A[j] then Cyclomatic complexity of the program.

This metric is useful because of properties

of Cyclomatic complexity (M) -

end do;

i=i+1; 1. M can be number of test cases to achieve branch

coverage (Upper Bound)

2. M can be number of paths through the graphs.

end do; (Lower Bound)

Flow graph for this program will be fig3 [1]

If (Condition 1)

Statement 1

Else

Statement 2

If (Condition 2)

Statement 3

Else

www.ijcat.com 154

International Journal of Computer Applications Technology and Research

Volume 8–Issue 05, 153-156, 2019, ISSN:-2319–8656

Statement 4

number of decision points in a program. The decision points

are if, for, for-each, while, do, catch, case statements in a

Cyclomatic Complexity for this program will be 9-7+2=4. source code.

necessary to the complete path coverage for the above

Examples of tools are

example.

OCLint - Static code analyzer for C and Related

Languages

Steps to be followed: devMetrics - Analyzing metrics for C# projects

Reflector Add In - Code metrics for .NET

The following steps should be followed for computing assemblies

Cyclomatic complexity and test cases design. GMetrics - Find metrics in Java related applications

NDepends - Metrics in Java applications

Step 1 - Construction of graph with nodes and edges from the

code

4 USES OF CYCLOMATIC

Step 2 - Identification of independent paths COMPLEXITY:

Step 3 - Cyclomatic Complexity Calculation

Cyclomatic Complexity is a very common buzz word in the

Step 4 - Design of Test Cases Development community. This technique is mainly used to

determine the complexity of a piece of code or functionality

Once the basic set is formed, TEST CASES should be written [1].

to execute all the paths.

The technique was developed by MaCabe and helps to

identify the below 3 questions for the programs / features

More on V (G):

Cyclomatic complexity can be calculated manually if the Is the feature / program testable?

program is small. Automated tools need to be used if the Is the feature/ program understood by every one?

program is very complex as this involves more flow graphs. Is the feature / program reliable enough?

Based on complexity number, team can conclude on the

actions that need to be taken for measure. As a QA we can use this technique to identify the “level” of

our testing. It is a practice that if the result of Cyclomatic

Table 1 : Overview on the complexity number and complexity is more or a bigger number, we consider that piece

corresponding meaning of v (G): of functionality to be of complex nature and hence we

conclude as a tester; that the piece of code / functionality

requires an in-depth testing. On the other hand if the result of

1.4 Complexity 1.5 Meaning the Cyclomatic Complexity is a smaller number, we conclude

Number as QA that the functionality is of less complexity and decide

1.6 1-10 1.7 Structured and well the scope accordingly.

written code

High Testability

Cost and Effort is less Cyclomatic Complexity can prove to be

1.8 10-20 1.9 Complex Code very helpful in

Medium Testability

Cost and effort is Medium Helps developers and testers to determine

1.10 20-40 1.11 Very complex Code independent path executions

Low Testability Developers can assure that all the paths have been

Cost and Effort are high tested atleast once

1.12 >40 1.13 Not at all testable Helps us to focus more on the uncovered paths

Very high Cost and Effort Improve code coverage in Software Engineering

Evaluate the risk associated with the application or

program

3 TOOLS FOR CYCLOMATIC Using these metrics early in the cycle reduces more

risk of the program

COMPLEXITY CALCULATION:

the application. Some complexity calculation tools are used

www.ijcat.com 155

International Journal of Computer Applications Technology and Research

Volume 8–Issue 05, 153-156, 2019, ISSN:-2319–8656

5. CONCLUSION:

Box and structured testing in Software development. It is

mainly used to evaluate complexity of a program. If the

decision points are more, then complexity of the program is

more. If program has high complexity number, then

probability of error is high with increased time for

maintenance and trouble shoot.

6. ACKNOWLEDGMENTS:

Bhagini Seva Mandals Mr. Atul R. Ajmera , College

Director Dr. Rajeev B. Kharat, Dr. Jagdish Kute,Centre

coordinator Mr.Sanjay Mali, College Liberian Mr. Atul

Khairnar , Our College OS Mr.M.D.Pathak, Mrs.Megha

V.Kamerkar,Mr.Neeraj Dhaghe, faculty member Miss.

Jayshri Deore, Miss. Gayatri Sharma and office Staff of

the WKBSM Dr. Suryakanta R. Ajmera MCA College

for Women Dhule Maharashtra, India for motivation

and encouragement which helped us to complete this

research paper.

7. REFERENCES:

[1] https://www.guru99.com

Practitioner’s Approach Tata McGraw Hill, New Delhi.

Complexity by Ramesh Patelia and Shipan vyas.

complexity/

Publication

www.ijcat.com 156

- 03_TOSUploaded byjeovani arnigo
- testing-sw-concept-1200317215102236-3Uploaded byleogopal
- IJCER (www.ijceronline.com) International Journal of computational Engineering researchUploaded byInternational Journal of computational Engineering research (IJCER)
- fgridUploaded byapi-3706534
- sinamicsUploaded byserege
- Assignment for Week3Uploaded bySujith Mrinal
- EmbeddedUploaded bykrish22041983
- Integration TestingUploaded bycyrus_vid
- The Ring programming language version 1.3 book - Part 67 of 88Uploaded byMahmoud Samir Fayed
- Replicated ConfigurationsUploaded byTimothy Parks
- computer engineeringUploaded byapi-257831417
- ICT 22(6)Uploaded byIan Gardose Dela Cruz
- Angle DebugUploaded byRaphael Miguel
- Tutorial c for AvrUploaded byStepanus Kukuh Kurniadi
- 10.1.1.62Uploaded byAnonymous JEF9ZRTg
- Project CodeUploaded byJuhi Yeasmin
- Compiler DesignUploaded byNiranjan Pandey
- ahblitUploaded byAliya Sarun
- System ApproachUploaded bychandrimachaterjee
- Time TableUploaded bysumeet_kamran1689
- Prosesador en digitalesUploaded bycigua
- Project Plan - Infrastructure ProjectUploaded byDeclanOCurry
- Back Improvement Exam TimeTable of III Sem. Jan. 2014Uploaded byiimet_grras
- 1MRK580020-BEN en TOC Time Delayed Overcurrent ProtectionUploaded byriddler_007
- IqbalUploaded byadam rahman
- BALANCE-LINE-SISMILUploaded byjopamaco
- DebugUploaded bysamzha
- SImple Decoration ApplicationUploaded byMoazzamMalik
- FWE03YDG56ZZXYWUploaded byVirat
- tortureUploaded byapi-296709346

- Application for Recording Operational Activities in the Helpdesk Division (Case Study : PT.Maybank Indonesia, Tbk)Uploaded byATS
- A Review of Fuzzy Logic Model for Analysis of Computer Network Quality of ExperienceUploaded byATS
- Density Based Traffic Signalling System using Image ProcessingUploaded byATS
- A Learnability Model for Children Mobile ApplicationsUploaded byATS
- Search Engine Development to Enhance User CommunicationUploaded byATS
- A Model for Code Restructuring, A Tool for Improving Systems Quality In Compliance With Object Oriented Coding PracticeUploaded byATS
- Frequent Itemset in Sequential Pattern Matching Using BigdataUploaded byATS
- Application of Knowledge Management System Using Influence of Inukshuk and Kano Model Case Study : Palembang Private Higher EducationUploaded byATS
- Student Performance PredictionUploaded byATS
- Analysis of Student Feedback using Deep LearningUploaded byATS
- Data Replication for the Distributed Database Using Decision Support SystemsUploaded byATS
- Designing Framework for Data Warehousing of Patient Clinical Records using Data Visualization Technique of Nigeria Medical RecordsUploaded byATS
- An Approach of Data Processing and Sales Prediction Model for E-commerce PlatformUploaded byATS
- A Comparative Analysis of Standard and Ensemble Classifiers on Intrusion Detection SystemUploaded byATS
- Research on Modulation recognition technology based on Machine learningUploaded byATS
- ijcatr08041004.pdfUploaded byATS
- Optimal Placement of Capacitor Bank in Reorganized Distribution Networks Using Genetic AlgorithmUploaded byATS
- Design of Survey Tools for Obstacle Height Monitoring on the Line of Sight Communication PathUploaded byATS
- A K-Means Based Multi-level Text Clustering Algorithm for Retrieval of Research InformationUploaded byATS
- Application of Cortical Learning Algorithms to Movement ClassificationUploaded byATS
- Advanced Characteristic Analysis of Real Time Junk Occurrences in TwitterUploaded byATS
- An Algorithm for the Spatiotemporal Dynamic of Insect Pest in Complex Agricultural SystemUploaded byATS
- Fuzzy Model for Diagnosis of Bacterial MeningitisUploaded byATS
- Web View-Based E-Time Applications for Communities (Case Study : Polresta Bogor Kota)Uploaded byATS
- Research on Cloud Hard Disk Capacity Prediction Scheme Based on Time Series ModelUploaded byATS
- A Hybrid WOFOST and Cropsyst Model for the Prediction of Crop YieldUploaded byATS

- Books, Scribes and Sequences in Medieval Norway Vol. 1 - Aaslaug OmmundsenUploaded byFreyjas Gal
- UntitledUploaded byM-NCPPC
- PLAN PreviewUploaded byHelen
- 620 Fce Marks and CommentaryUploaded byDiego Escobar
- Irmis Popoff Gurdjieff.pdfUploaded bydarkdoudou
- Causation in warihio.pdfUploaded byLuis Ramiro Casas Salido
- EXAMINATION 3BGU.docxUploaded byMiguel Aucancela Saldana
- portfolio task 1Uploaded byapi-321156238
- Python Scientific Slides (Boston University)Uploaded byatom tux
- Motivating Speaking Activities for Lower LevelsUploaded byRildo Reis
- 03ICS100FeaturesSept05Uploaded bybull517
- 353462422-Estimation-and-Costing-by-m-Chakraborty-PDF.pdfUploaded bySoumikDas
- The First Hexagram of the I ChingUploaded byCarvalho
- Legends of the Gods by Sir E. A. Wallis BudgeUploaded bymatabau
- Third Quarter Exam English 4Uploaded byErrol Rabe Solidarios
- cse20012befullUploaded byArifMohammed
- OrtonGillinghamUploaded byCess Urbano
- APA Style GuideUploaded byY.h. Tariq
- Ice Faces Developers GuideUploaded bytakotak
- King Lear SubtitleUploaded byChheang Sophea
- Banana (Musa Spp.) Domestication in the Asia Pacific RegionUploaded byRoberto R Pantoja
- ela lesson plan 4th grade 1Uploaded byapi-314173677
- Extreme AdjectivesUploaded byShego Linares
- Methodological Principles of Language TeachingUploaded bycarolinaroman2002
- 216271737-Ece-IV-Fundamentals-of-Hdl-10ec45-Notes.pdfUploaded byksreddy2002
- Nouns and noun determiners.pdfUploaded byIulia Onofrei
- 187594574-New-Perspectives-on-the-Qur-an-The-Qur-an-in-Its-Historical-Context-2-by-Gabriel-Said-Reynolds.pdfUploaded byOmar Mohammed
- Find and Replace Text or Other Items - Word - OfficeUploaded byபிரசன்னகுமார் ஆனந்தன்
- editan____Living English (CD Book).docxUploaded byM Luthfi Al Qodry
- Mega Assign Men 1Uploaded byYounus Shah