Computing Students - Computer Science Degree Notes
Home Contact Shop Notes Questions Programming Links Dictionary Coursework FORUM Tutors
  Recommended Kelkoo Searches: Computer Science | Computing | Computer Systems | Database | Computing Revision  

Notes > Software Analysis / Testing > Control Flow Graphs (CFG)

A Control Flow Graph (CFG) is a diagrammatic representation of a program and its execution. A CFG shows all the possible sequences of statements of a program. CFGs consist of all the typical building blocks of any flow diagrams. There is always a start node, an end node, and flows (or arcs) between nodes. Each node is labelled in order for it to be identified and associated correctly with its corresponding part in the program code.

CFGs allow for constructs to be nested in order to represent nested loops in the actual code.

If Loop

If Loop CFG

Nested If Loop

Nested If Loop CFG

While Loop

While Loop CFG

Do While Loop

Do While Loop CFG

In programs where while loops exist, there are potentially an infinite number of unique paths through the program. Every path through a program has a set of associated conditions. Finding out what these conditions are allows for test data to be created. This enables the code to be tested to a suitable degree.

The conditions that exist for a path through a program are defined by the values of variable which change through the execution of the code. At any point in the program execution, the program state is described by these variables. Statements in the code such as "x = x + 1" alter the state of the program by changing the value of a variable (in this case, x).

Infeasible paths are those paths which cannot be executed. Infeasible paths occur when no values will satisfy the path constraint.

Search for "Control Flow Graphs (CFG)" on: Google | Kelkoo | Amazon | eBay (UK) | eBay (US)

Search for "Control Flow Graphs (CFG)" on the rest of Computing Students: Control Flow Graphs (CFG)






Home | Contact | Shop | Notes | Questions | Programming | Links | Dictionary | Coursework | Tutors Sponsored Links: Affiliate Program Articles | Computer Science Definitions | CS Degree Notes
Copyright © 2005-2009 ComputingStudents.com
This site is to be used in accordance with the ComputingStudents.com User Agreement
High Wycombe Web Design