Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Practical differences between control flow graph and call (flow?) graph?

Wikipedia has a definition for a control flow graph. I've also heard terminology thrown around referring to 'call (flow?) graph', but can't find any relevant resources. What is the relationship between the two?

like image 962
ChaimKut Avatar asked Mar 27 '12 11:03

ChaimKut


People also ask

What is the difference between a flow chart and a control flow graph?

CONTROL FLOW GRAPHS Vs FLOWCHARTS:The flowchart focuses on process steps, where as the flow graph focuses on control flow of the program. The act of drawing a control flow graph is a useful tool that can help us clarify the control flow and data flow issues.

What is control data flow graph?

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.

What are the different types of control flow diagram?

There are several types of control-flow diagrams, for example: Change-control-flow diagram, used in project management. Configuration-decision control-flow diagram, used in configuration management. Process-control-flow diagram, used in process management.

What are the elements of control flow graph?

A control-flow graph (cfg) models the flow of control between the basic blocks in a program. A cfg is a directed graph, G = (N, E). Each node n ∈ N corresponds to a basic block. Each edge e = (ni, nj) ∈ E corresponds to a possible transfer of control from block ni to block nj.


1 Answers

Wikipedia defines a call graph as a representation of the calling relationships between subroutines in a program. In a call graph, an edge between two nodes f and g:

      f --> g

represents the fact that subroutine f calls subroutine g. A call graph gives an inter-procedural view of a program.

A control flow graph (CFG) provides finer "details" into the structure of the program as a whole, and of the subroutines in particular. For instance, the CFG of a subroutine f will make explicit all of the paths that are induced by a conditional branch:

                             / branch1 \
    begin --> condition -->             --> codeblock --> g --> end
                             \ branch2 /

This kind of CFG is used to build an intra-procedural view of a subroutine.

like image 139
ftk Avatar answered Sep 23 '22 14:09

ftk