Thread: October 2020
View Single Post
Old 2020-10-05, 20:56   #11
Oct 2017

2·3·19 Posts

Originally Posted by uau View Post
I interpreted it as creating the control-flow graph based only on the existence of jump commands, so it does not depend on values of a and b. Actual behavior of the program will depend on those, but the graph won't.

I believe the sequence 0, 2, 2, ... starts from 1 for path length (that's another kind-of-flaw in the problem description, as it links to an OEIS sequence with a definition that doesn't match, without mentioning that you need a different offset). The 0 means that there is no direct path from the starting node in the graph to the end node, then 2 means there are 2 possible paths with 2 steps.
Thank you. Good explanation. The length of a path from the entry node to the exit node is the number of needed edges. a6 = 17 will say that there are 17 different paths from entry to exit needing 6 edges.
Meanwhile the cfg of the example can be seen, and it were a good exercise to write down the sequence:
0,0,0,1,... (there is no path of length 1,2,3 and only one path of length 4)
Unfortunately I don't understand the edge from 60 to 70.
Dieter is offline   Reply With Quote