Python || 96.60% Faster || Easy || Dijkstra's
\ndef countPaths(self, n: int, roads: List[List[int]]) -> int:\n        adj=[[] for i in range(n)]\n        for u,v,t in roads:\n            adj[u].append((v,t)
```\ndef countPaths(self, n: int, roads: List[List[int]]) -> int:\n        adj=[[] for i in range(n)]\n        for u,v,t in roads:\n            adj[u].append((v,t))\n            adj[v].append((u,t))\n        dist=[float(\'inf\')]*n\n        ways=[0]*n\n        ways[0]=1\n        dist[0]=0\n        pq=[]\n        heapify(pq)\n        heappush(pq,(0,0))\n        mod=10**9+7\n        while pq:\n            time,node=heappop(pq)\n            for v,t in adj[node]:\n                if dist[v]>t+time:\n                    dist[v]=t+time\n                    heappush(pq,(dist[v],v))\n                    ways[v]=ways[node]\n                elif dist[v]==t+time:\n                    ways[v]=(ways[v]+ways[node])%mod\n        return ways[n-1]%mod\n```\n\n**An upvote will be encouraging**
['Graph', 'Python', 'Java', 'Python3']