Please download and install Control Flow Graph Factory Plugin.
Let's get started with the first step. Most tutorials start out with a simple Hello World program. We've created a program those graph includes a branch element. Just copy the following sample to your eclipse project and compile it.
package test; public class C2 { public static float abs(float a) { float b = 0.0F; if(a <= b){ return (b - a); } return a; } }
To generate the graph for the method main select the method
in package explorer and open the context menu "Create Control Flow
Graph". Select submenu "Sourcecode graph" to generate a source code
graph for this method.

Now you select the target folder in the export dialog. To save the graph file click OK.

The graph is generated and open in a Control Flow Graph Editor.

Now you can generate a bytecode or a basic code graph in the same way. Use for that the context menu in the package explorer "Create Control Flow Graph/Bytecode graph" or "Create Control Flow Graph/Basic block graph.
The Control Flow Graph Factory editor window provides you with some editing functions. You can move copy or delete the graph elements. You can order layout your elements by using the layout algorithms or layout the elements manually.

To export the modified graph in DOT, GraphXML format or to an image please use the export functions provided by the Control flow graph Factory. You can export the graph directly to DOT or GraphXML format by selecting the format in the context menu.

The Control Flow Graph Factory provides a simple DOT text editor for editing the dot files.

You can generate graphs for the selected method, selected class or for the whole package.

Thank you for practicing with this tutorial. For questions and discussion around the control flow graph topics please use our contact form.