written 8.6 years ago by | • modified 5.5 years ago |
Similar questions
Compare CFG and DFG
Marks: 7/10 M
Year: Dec 2012,Dec 2013
written 8.6 years ago by | • modified 5.5 years ago |
Similar questions
Compare CFG and DFG
Marks: 7/10 M
Year: Dec 2012,Dec 2013
written 8.6 years ago by |
Control Flow Graph :
A CFG is a graphical representation of a program unit.
Three symbols are used to construct a control flow graph which includes a rectangle used to represent a sequential computation, a decision box labelled with T and F to represent True and False evaluations respectively and a merge point.
A control flow graph is process oriented.
It doesn’t manage or pass data between components.
A control flow diagram illustrates how different programs, applications, services, or endpoints act on and process information to achieve certain ends within the context of a system.
Data Flow Graph :
A dataflowgraph is a graphical representation of the "flow" of data through an information system.
A DFD shows what kind of information will be input to and output from the system, where the data will come from and go to, and where the data will be stored. It does not show information about the timing of processes, or information about whether processes will operate in sequence or in parallel.
A data flow graph is information oriented
It passes data between other components.
A data flow diagram illustrates how data flows from logical point to point in a system. Consider the following example which illustrates the difference between control flow graph and data flow graph
Program to compute the largest number among three numbers :
inta,b,c ;
if( a>b && a > c)
{
System.out.println (“ The greatest number is “ +a);
}
else if ( b>c)
{
System.out.println (“ The greatest number is” +b);
}
else
{
System.out.println(“ The greatest number is “ +c);
}
Control Flow Graph for the greatest of three numbers :
Data Flow Graph for greatest of three numbers :
Figure: Data Flow Graph for greatest of three numbers