HITEC University Taxila
Department of Computer Science (BS Computer Science Program)
Assignment # 4
Software Quality Assurance
th
BS (CS)-6 Semester Total Marks: 10
Target C-O (C-2) Important Due Date: 4th July 2025.
Note: Soft-Copy must be uploaded at Google-Classroom platform.
Let G be the directed graph in Figure below:
a. Assess and describe the graph, depicting vertices/nodes and edges.
b. Find two simple paths from v1 to v6.
c. Find indegree (Fan-in) and outdegree (Fan-out) for all nodes.
d. Calculate the Module Complexity (MC) for all the nodes.
e. Find all the cycles in the graph.
f. Calculate Cyclomatic Complexity (CC) using this formula only
CC = E – N + 2P
Where E = No. of Edges
N = No. of Nodes and
P = No. of Programs
(Solution)
a. Assess and describe the graph, depicting vertices/nodes and edges.
The vertex set V has six vertices and the edge set E has nine (directed) edges as follows:
V = {v1, v2, v3, v4, v5, v6} and
E = {(v1,v2), (v2,v4), (v6,v4), (v5,v6), (v3,v5), (v3,v1), (v1,v5), (v6,v1), (v2,v3)}
b. Find two simple paths from v1 to v6.
The paths from v1 to v6 are: (v1, v5, v6) and (v1,v2,v3,v5,v6).
c. Find indegree and outdegree for all nodes.
Node v1 v2 v3 v4 v5 v6
Indegree 2 1 1 2 2 1
Outdegree 2 2 2 0 1 2
d. Calculate the Module Complexity (MC) for all the nodes. Where indegree=Fan-in and
Outdegree=Fan-out.
Module Complexity= MC= (Indegree + Outdegree ) 2
For v1, MC = (2+2) 2 = 16
For v2, MC = (1+2) 2 = 9
For v3, MC = (1+2) 2 = 9
For v4 , MC = (2+0) 2 = 4
For v5, MC = (2+1) 2 = 9
For v6 , MC = (1+2) 2 = 9
e. Find all cycles in the graph.
V1 --> V2 --> V3 --> V1
V1 --> V5 --> V6 --> V1
f. Find CC.
CC = E – N + 2p
= 9 - 6 + 2(1)
= 5