<p>You can try this:
(this is from <a href="http://arxiv.org/PS_cache/cond-mat/pdf/0308/0308217v1.pdf" rel="nofollow">http://arxiv.org/PS_cache/cond-mat/pdf/0308/0308217v1.pdf</a>, Pg 5).</p>

<p>We will give weights to different vertices starting with s, based on the number of paths to the vertex from S and also set their distance based on the no of edges they are away from s.</p>

<ol>
<li>Start with wt(S) = 1 and d(s) = 0;</li>
<li>Every vertex i adjacent to S is given weight = w(s) = 1 and d(i)  = (d) +1;</li>
<li><p>For each vertex j adjacent to one of these vertices and d(j) not yet defined, 
if w(j) = 0, then assigned w(i)=w(j) /<em>that is assign the wt of parent to j</em>/
else if d(j)=d(i) +1 , then w(j) = w(i) + 1.</p></li>
<li><p>Repeat step 3 till T is reached. The wt(t) will give the number of shortest paths from s to T.  </p></li>
</ol>

<p>Accordingly, the paper explains why this is linear.</p>
Why does this solution say the DFS have to run in reverse?
<p>Wouldn't it keep finding t if we start at s?</p>

<blockquote>
  <p>Give a linear-time algorithm that takes as input a directed acyclic graph G = (V,E) and two vertices s and t, and returns the number of paths from s to t in G.</p>
</blockquote>

<hr>

<p>solution:</p>

<blockquote>
  <p>The basic idea here is to start at vertex t, and use depth-first search in reverse direction until we reach vertex s. Each and maintains a counter which indicates the number of unique reverse paths found from vertex t.</p>
  
  <ol>
  <li>Initialize counters to 0 for all vertices.</li>
  <li>Start depth-first-search in reverse direction using vertex t as a root.</li>
  <li>For each edge (u, y) examined in the breadth-first search. <code>Counter(v) = max{ Counter(v) + 1, Counter(v) + Counter(u) }</code></li>
  <li>Return Counter(s).</li>
  </ol>
</blockquote>