5

I need to draw an cause-effect-graph, I have read a lot about these graphs but still I am not able to draw one. I you could help me it would be perfect. Here is the description of program:

function foo() is checking the user inputted string and changing some chars, 1. if the char in string is '&' function will replace it with '&amp;' 2. if the char in string is '<' function will replace it with '&lt;' 3. if string does not contains any of these chars the string will be returned without changes.

Now I could not come with better solution as this: Assumptions:

  1. char is '&'
  2. char is '<'
  3. no char in string

Effects:

  1. char changed to '&amp;'
  2. char changed to '&lt;'
  3. string unchanged

Explicit join:

  1. 4 or 5

cfg graph

Could you guys confirm this solution?

4

My solution below. I think it's best to have only one level of 'effects'. Also, the string not replacing anything is the result of a cause that didn't happen, so I rendered it as such.

Additional thought: the 'mutually exclusive' lines are usually applied to causes, not effects (because they are determined by the graph).

  • C1: string contains '&'.
  • C2: string contains '<'.
  • E1: string replacement for C1 occurs.
  • E2: string returned as is.
  • E3: string replacement for C2 occurs.

Note that E1 and E3 may happen together. E2 only happens if neither of C1 and C2 are true.

Graph

Another example similar to the approach of my solution is found here.

2
  • Thank you for your solution, It may be correct, I will wait some time if someone has some different opinion, if not I will mark your answer correct – nocturne May 28 '17 at 19:31
  • 1
    @nocturne I have added a different graph that I'm now completely convinced of :) – FDM May 28 '17 at 19:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.