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?
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.