The Gateway to Computer Science Excellence
+4 votes
443 views

Construct a DAG for the following set of quadruples:

  • E:=A+B
  • F:=E-C
  • G:=F*D
  • H:=A+B
  • I:=I-C
  • J:=I+G
in Compiler Design by Veteran (105k points) | 443 views
0
is it contain 10 edges and 9 nodes
0
How to solve it?

1 Answer

+8 votes
Best answer

The Steps for constructing the DAG are shown below.

$I.\ E=A+B$

$II.\ F=E-C$

$III.\ G=F*D$ 

$IV.\ H=A+B$ 

$V.\ I=I-C$

$VI.\ J=I+G$

by Boss (24.2k points)
edited by
0
A DAG should have directed edges. Which direction are the edges in your graph?
0
Upwards
0
How can we have two representations in the graph for the same node (here, $I$)?
0
Here the '$-$' node is representing updated value of I.

Think for a minute , is there any other way to represent I=I-C without making cyclic graph ?
0
The 'A' in "DAG" is what bothered me. But yeah, I can't think of another way of making it acyclic either.
0

@ajaysoni1924

There was no need to update the images as they are already clear.

+3
@Satbir
Doing it for Gate overflow book almost every image is drawn again using latex

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,737 questions
57,379 answers
198,523 comments
105,317 users