Control Flow Graph

What Does Control Flow Graph Mean?

In computer science, a control flow graph (CFG) is the graphical representation of control flow or computation during the execution of programs or applications. Control flow graphs are mostly used in static analysis as well as compiler applications, as they can accurately represent the flow inside of a program unit.


The control flow graph owes much of its development to Frances E. Allen.

Techopedia Explains Control Flow Graph

A control flow graph is process oriented and can show all the paths that can be traversed during a program execution. A control flow graph can also be considered as a directed graph in which edges portray control flow paths and the nodes portray basic blocks, which are straight line segments without any jumps or branching.

In a control flow graph, two specially designated blocks exist: entry and exit blocks. The entry block allows the control to enter into the control flow graph, whereas the control flow leaves through the exit block. In other words, the control flow graph is comprised of all the building blocks involved in a flow diagram such as the start node, end node and flows/arcs between the nodes. A control flow graph can depict how different program units or applications process information between different ends in the context of the system.

There are many advantages associated with a control flow graph. It can easily summarize the information per each basic block. It can easily locate unreachable codes of a program, and syntactic structures such as loops are easy to find in a control flow graph.


Related Terms

Latest Computer Science Terms

Related Reading

Margaret Rouse

Margaret Rouse is an award-winning technical writer and teacher known for her ability to explain complex technical subjects to a non-technical, business audience. Over the past twenty years her explanations have appeared on TechTarget websites and she's been cited as an authority in articles by the New York Times, Time Magazine, USA Today, ZDNet, PC Magazine and Discovery Magazine.Margaret's idea of a fun day is helping IT and business professionals learn to speak each other’s highly specialized languages. If you have a suggestion for a new definition or how to improve a technical explanation, please email Margaret or contact her…