Straightforward Python Dijkstra + DP - Beats 98% Runtime and Memory!
\nclass Solution:\n    def countRestrictedPaths(self, n: int, edges: List[List[int]]) -> int:\n        graph = defaultdict(dict)\n        for u, v, w in edges:\
```\nclass Solution:\n    def countRestrictedPaths(self, n: int, edges: List[List[int]]) -> int:\n        graph = defaultdict(dict)\n        for u, v, w in edges:\n            graph[u][v] = w\n            graph[v][u] = w\n        \n        paths = [0] * (n+1)\n        paths[n] = 1\n        dists = [-1] * (n+1)\n        pq = [(0, n)]\n        \n        while pq:\n            dist, node = heappop(pq)\n            if dists[node] != -1:\n                continue\n            dists[node] = dist\n            for v, w in graph[node].items():\n                if dists[v] == -1:\n                    heappush(pq, (dist + w, v))\n                elif dists[v] < dists[node]:\n                    paths[node] += paths[v]\n                    paths[node] %= 10**9 + 7\n            if node == 1:\n                return paths[node]\n     \n        return 0\n```
['Dynamic Programming', 'Python']