Number of edges and nodes in this control flow graph (CFG)?

512 Views Asked by At

I'm having difficulty with nodes and arcs of a control flow graph (CFG). Please, could someone help me by telling me how many edges and nodes are in this control flow graph (CFG) ?

enter image description here

Arcs and nodes control flow graph

1

There are 1 best solutions below

4
Christophe On

I can't do your work for you. But here are some hints that should help you:

  • The nodes are numbered, so they should be easy to count. Just don't forget to add start and end, which are also nodes.

  • For the edges, it's more tricky, as you might get confused by the graphical layout. You need to count the edges from one node to another, without counting additional graphical elements that are there only for the nice layout. For example 7 goes to end, that's 1 edge even if there are two graphical arrows; or 1 goes to end, even if there are three different lines.

Btw: control flow graphs are not UML. It's a family of models, which has flowcharts as specialization, and that has some overlaps with UML activity diagrams.