You are on page 1of 3

Control Flow Graph

Input gol Gol =1 || Gol =2 Gol = 3 || Gol = 4

2 3
1

A = 1000000 A = 2000000

4
12

0 Masa > 5 Tun = 1 && Tun = 2 B = 500000 * masa


6 7
13 8

Tun = 3 && Tun = 4 B = 700000 * masa


14
15

c = 35000 * kehadir Total = a + b + c

10 11

V(G) = cyclomatic complexity


E = Total jumlah edge
N = Total jumlah node
V(G) = E – N + 2
V(G) = 19 edge – 15 node + 2 = path 6
Path 1 : 1-2-3-1
Path 2: 1-2-12-5-6-13-9-10-11
Path 3 : 1-2-3-4-5-6-7-8-9-10-11
Path 4: 1-2-3-12-5-6-7-8-9-10-11
Path 5: 1-2-3-4-5-6-7-14-15-9-10-11
Path 6: 1-2-3-4-5-6-7-14-15-9-10-11
Diagram Control Flow Graph Golongan

Input gol Gol =1 || Gol =2 Gol = 3 || Gol = 4


3
1 2

a = 1000000 a = 2000000

4
7

Return(a)

V(G) = cyclomatic complexity


E = Total jumlah edge
N = Total jumlah node
V(G) = E – N + 2
V(G) = 7 edge – 7 node + 2 = path 2
Path 1 : 1-2-7-5-6
Path 2 : 1-2-3-4-5-6
Diagran Control Flow Graph Masa kerja

Input x

Masa > 5

2 5
4
b=0
tun = 1 && tun = 2 b = 500000 * masa
3

tun = 3 && tun = 4 b = 700000 * masa

7 8

Return(b)

V(G) = E – N + 2
V(G) = 10 edge – 9 node + 2 = path 3
Path 1: 1-2-4-5
Path 2: 1-2-3-6-9
Path 3: 1-2-4-7-8

You might also like