{"id":294,"date":"2018-07-23T04:38:15","date_gmt":"2018-07-23T04:38:15","guid":{"rendered":"http:\/\/csp9.epgpbooks.inflibnet.ac.in\/?post_type=chapter&#038;p=294"},"modified":"2018-07-23T04:39:29","modified_gmt":"2018-07-23T04:39:29","slug":"cyclomatic-complexity","status":"publish","type":"chapter","link":"https:\/\/ebooks.inflibnet.ac.in\/csp9\/chapter\/cyclomatic-complexity\/","title":{"rendered":"Cyclomatic Complexity"},"content":{"raw":"<strong>McCabe\u2019s Complexity Measures:<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">McCabe, in 1976, proposed Cyclomatic Complexity Measure to quantify complexity of given software. It is graph driven model that is based on decision-making constructs of program such as if-else, do-while, repeat-until, switch-case and goto statements. McCabe\u2019s metrics are based on a control flow representation of the program. A program graph is used to depict control flow. Nodes represent processing tasks (one or more code statements), edges represent control flow between nodes.<\/p>\r\n&nbsp;\r\n\r\n<img class=\"alignnone size-full wp-image-295 aligncenter\" src=\"http:\/\/csp9.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/54\/2018\/07\/pic.jpg\" alt=\"\" width=\"639\" height=\"170\" \/>\r\n\r\n&nbsp;\r\n\r\nCyclomatic complexity can be defined as Set of independent paths through the graph (basis set)\r\n\r\n&nbsp;\r\n\r\nV(G) = E \u2013 N + 2\r\n\r\n&nbsp;\r\n\r\nE is the number of flow graph\r\n\r\nedges N is the number of nodes\r\n\r\n&nbsp;\r\n\r\nV(G) = P + 1\r\n\r\n&nbsp;\r\n\r\nP is the number of predicate nodes\r\n\r\nA predicate node is a node with two or more edges originating from it.\r\n\r\n&nbsp;\r\n\r\n<strong>Summary<\/strong>\r\n\r\n&nbsp;\r\n<p style=\"text-align: justify\">Cyclomatic complexity or structural complexity helps in identifying the upper bound on the maximum no of linearly independent paths that an algorithm can take. This helps in generating test cases.<\/p>\r\n&nbsp;\r\n\r\n<img class=\"size-full wp-image-298 aligncenter\" src=\"http:\/\/csp9.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/54\/2018\/07\/pic-1.jpg\" alt=\"\" width=\"638\" height=\"195\" \/>","rendered":"<p><strong>McCabe\u2019s Complexity Measures:<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">McCabe, in 1976, proposed Cyclomatic Complexity Measure to quantify complexity of given software. It is graph driven model that is based on decision-making constructs of program such as if-else, do-while, repeat-until, switch-case and goto statements. McCabe\u2019s metrics are based on a control flow representation of the program. A program graph is used to depict control flow. Nodes represent processing tasks (one or more code statements), edges represent control flow between nodes.<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-295 aligncenter\" src=\"http:\/\/csp9.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/54\/2018\/07\/pic.jpg\" alt=\"\" width=\"639\" height=\"170\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp9\/wp-content\/uploads\/sites\/54\/2018\/07\/pic.jpg 639w, https:\/\/ebooks.inflibnet.ac.in\/csp9\/wp-content\/uploads\/sites\/54\/2018\/07\/pic-300x80.jpg 300w, https:\/\/ebooks.inflibnet.ac.in\/csp9\/wp-content\/uploads\/sites\/54\/2018\/07\/pic-65x17.jpg 65w, https:\/\/ebooks.inflibnet.ac.in\/csp9\/wp-content\/uploads\/sites\/54\/2018\/07\/pic-225x60.jpg 225w, https:\/\/ebooks.inflibnet.ac.in\/csp9\/wp-content\/uploads\/sites\/54\/2018\/07\/pic-350x93.jpg 350w\" sizes=\"auto, (max-width: 639px) 100vw, 639px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>Cyclomatic complexity can be defined as Set of independent paths through the graph (basis set)<\/p>\n<p>&nbsp;<\/p>\n<p>V(G) = E \u2013 N + 2<\/p>\n<p>&nbsp;<\/p>\n<p>E is the number of flow graph<\/p>\n<p>edges N is the number of nodes<\/p>\n<p>&nbsp;<\/p>\n<p>V(G) = P + 1<\/p>\n<p>&nbsp;<\/p>\n<p>P is the number of predicate nodes<\/p>\n<p>A predicate node is a node with two or more edges originating from it.<\/p>\n<p>&nbsp;<\/p>\n<p><strong>Summary<\/strong><\/p>\n<p>&nbsp;<\/p>\n<p style=\"text-align: justify\">Cyclomatic complexity or structural complexity helps in identifying the upper bound on the maximum no of linearly independent paths that an algorithm can take. This helps in generating test cases.<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-298 aligncenter\" src=\"http:\/\/csp9.epgpbooks.inflibnet.ac.in\/wp-content\/uploads\/sites\/54\/2018\/07\/pic-1.jpg\" alt=\"\" width=\"638\" height=\"195\" srcset=\"https:\/\/ebooks.inflibnet.ac.in\/csp9\/wp-content\/uploads\/sites\/54\/2018\/07\/pic-1.jpg 638w, https:\/\/ebooks.inflibnet.ac.in\/csp9\/wp-content\/uploads\/sites\/54\/2018\/07\/pic-1-300x92.jpg 300w, https:\/\/ebooks.inflibnet.ac.in\/csp9\/wp-content\/uploads\/sites\/54\/2018\/07\/pic-1-65x20.jpg 65w, https:\/\/ebooks.inflibnet.ac.in\/csp9\/wp-content\/uploads\/sites\/54\/2018\/07\/pic-1-225x69.jpg 225w, https:\/\/ebooks.inflibnet.ac.in\/csp9\/wp-content\/uploads\/sites\/54\/2018\/07\/pic-1-350x107.jpg 350w\" sizes=\"auto, (max-width: 638px) 100vw, 638px\" \/><\/p>\n","protected":false},"author":4,"menu_order":36,"template":"","meta":{"_acf_changed":false,"pb_show_title":"on","pb_short_title":"","pb_subtitle":"","pb_authors":[],"pb_section_license":""},"chapter-type":[],"contributor":[],"license":[],"class_list":["post-294","chapter","type-chapter","status-publish","hentry"],"part":3,"_links":{"self":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp9\/wp-json\/pressbooks\/v2\/chapters\/294","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp9\/wp-json\/pressbooks\/v2\/chapters"}],"about":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp9\/wp-json\/wp\/v2\/types\/chapter"}],"author":[{"embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp9\/wp-json\/wp\/v2\/users\/4"}],"version-history":[{"count":3,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp9\/wp-json\/pressbooks\/v2\/chapters\/294\/revisions"}],"predecessor-version":[{"id":299,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp9\/wp-json\/pressbooks\/v2\/chapters\/294\/revisions\/299"}],"part":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp9\/wp-json\/pressbooks\/v2\/parts\/3"}],"metadata":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp9\/wp-json\/pressbooks\/v2\/chapters\/294\/metadata\/"}],"wp:attachment":[{"href":"https:\/\/ebooks.inflibnet.ac.in\/csp9\/wp-json\/wp\/v2\/media?parent=294"}],"wp:term":[{"taxonomy":"chapter-type","embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp9\/wp-json\/pressbooks\/v2\/chapter-type?post=294"},{"taxonomy":"contributor","embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp9\/wp-json\/wp\/v2\/contributor?post=294"},{"taxonomy":"license","embeddable":true,"href":"https:\/\/ebooks.inflibnet.ac.in\/csp9\/wp-json\/wp\/v2\/license?post=294"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}