We usually draw a control flow graph by hand using pen and paper while analyzing the control flow of a program. CFG helps us find independent paths ( Run the command below in a terminal. Output: This approach yields graph output having nodes marked as sentences, edges between nodes. Using linrary import and tkinter , we can do much better than just using one file pycfg.py . Run the command below After completion use the same whiletest.py for testing. We can run the following python program in whiletest.py . Below is the code — a
=
10
while
(a "
=
0
):
if
a
=
=
5
:
print
(a)
a
+
=
1
print
(
" exited "
)
python path_to / pycfg. py path_to / whiletest.py -d
Importing the library into the program
sudo pip install pycfg
python /path_to/this_file.py /path_to/whiletest.py
|
Output: