0

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

Christophe
  • 68,716
  • 7
  • 72
  • 138
kekkok
  • 11
  • 1
  • There are 10 nodes and 12 edges between these nodes. What exactly is the problem in counting them? – Progman Jun 04 '23 at 11:22

1 Answers1

0

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.

Christophe
  • 68,716
  • 7
  • 72
  • 138
  • Thank you for the suggestion. At this point I think that there are 10 nodes, is it true? Please, could you explain the concept of edges? I don't undestand edge's concept and I think that if I understand this I will complete the exercice by myself – kekkok Jun 04 '23 at 14:45
  • @kekokk the nodes are the boxes and the circles. The edges are a direct link between two nodes. Maybe this will help further: https://en.m.wikipedia.org/wiki/Graph_theory – Christophe Jun 04 '23 at 15:25
  • Thank you for the suggestion. I understand what is a node and now I am able to count the node but I still have trouble with the edges – kekkok Jun 05 '23 at 17:45
  • Now that you inderstand what a node is, go on rach node and count the number of arrows that leave the node. Ignore all the other arrows. – Christophe Jun 05 '23 at 18:08