cpts350 hw6 1. Let G be a DAG (a graph without loops) and 25,1) be two designated nodes

(there are many other nodes in G). Design an efﬁcient algorithm to count

the number of paths from u to v. 2. Let G be a DAG (a graph without loops) and 15,1) be two designated nodes

(there are many other nodes in G). In particular, each node in G is labeled

with a color and multiple nodes can share the same color. A good path is

one where the number of green nodes is bigger than the number of yellow

nodes. Design an efﬁcient algorithm to count the number of good paths from

a: to v. 3. Let G be a graph (so it may have loops) and u, v be two designated nodes

(there are many other nodes in G). In particular, each node in G is labeled

with a color and multiple nodes can share the same color. Suppose that ”y

is a regular expression on colors (e.g., (green + yellowyellow)*yellowblue).

An ugly path is one that the color sequence on the path satisﬁes the regular

expression 7. Design an efﬁcient algorithm to count the number of ugly paths

from u to ’0 (when the count is innﬁnite, return 00). 4. Let G be a graph that may contain loops and hence, the number of paths

from a designated start node to a designated end node may be inﬁnite. Un-

fortunately, you usually can’t say that one inﬁnite number is larger than

another. Here is the problem: sketch a way to compare the number of paths

in two graphs (that both may contain loops). (Hint: google perron, graph,

path count). 5. Let G be a control ﬂow diagram of a C-progrm (which can be automatically

generated). For each node a in the diagram, one can obtain the total number

0(a) of paths from the root of the diagram to u. Then, from what you got

from 4 above, you may sort all the C(u)’s for all u (even though some of

C(u)’s are inﬁnite) and then pick a ma“ that has the maximal C(u). Write a

mini-paper on how this will address the problem of testing a C-program. (if

you want, you can actully publish a paper on this get a Master degree!)