Skip to main content

Posts

Showing posts with the label cyclomatic complexity

Graph Theory | Cyclomatic complexity

What is Graph Matrix? A graph matrix is a square matrix whose size represents the number of nodes in the control flow graph.  Each row and column in the matrix identifies a node and the entries in the matrix represent the edges or links between these nodes. Conventionally, nodes are denoted by digits, and edges are denoted by letters. Example: Graph Examples Since the graph has 4 nodes , so the graph matrix would have a dimension of 4 X 4 . Matrix entries will be filled as follows : (1, 1) will be filled with ‘a’ as an edge exists from node 1 to node 1 (1, 2) will be filled with ‘b’ as an edge exists from node 1 to node 2. It is important to note that (2, 1) will not be filled as the edge is unidirectional and not bidirectional (1, 3) will be filled with ‘c’ as edge c exists from node 1 to node 3 (2, 4) will be filled with ‘d’ as edge exists from node 2 to node 4 (3, 4) will be filled with ‘e’ as an edge exists from node 3 to node 4 Connection Matrix A connection matrix is a ma...