Let $D=(V,A)$ be a simple directed acyclic graph, where $A$ is a set of arcs. Let $S$ be a subset of $\{(u,v)| \text{there is a directed path from $u$ to $v$}\}$. The $S$-length of a path $P$ is defined to be the number of elements of $S$ contained in $P$, here $(u,v)\in S$ is said to be contained in $P$ if $u,v \in V(P)$. For example, if $S =\{(u,v)| \text{there is a directed path from $u$ to $v$}\}$, then length of a path $P$ is ${L(P)}\choose{2}$ where $L(P)$ is the length of the path $P$. My question is to find a path of longest $S$-length in $D$. Is there a polynomial algorithm to solve it? If it is NP-hard, then is there a good approximation algorithm?
I am so sorry I realized there is a mistake in my old question. Here $S$ is a subset of $V\times V$,i.e, a subset of all pairs of vertices, but $S$ is not a subset of $A$.