c++ djkstra readable code
\nclass Solution {\npublic:\n    int mod = 1e9 + 7;\n    int dfs(int n, vector<int> &dp, vector<int> &dist, vector<vector<pair<int,int>>> &graph, int d) {\n    
```\nclass Solution {\npublic:\n    int mod = 1e9 + 7;\n    int dfs(int n, vector<int> &dp, vector<int> &dist, vector<vector<pair<int,int>>> &graph, int d) {\n        if(n == 1) \n            return 1;\n        long ans = 0;\n        if(dp[n] != -1) \n            return dp[n];\n\n        for(auto [i, w]: graph[n]) {\n            if(d < dist[i]) {\n                ans += dfs(i, dp, dist, graph, dist[i]) % mod; \n                ans %= mod;\n            }\n        }\n        return  dp[n] = ans;\n    }\n    void shortestPath(int n, vector<vector<pair<int,int>>> &graph, vector<int> &dist) {\n        set<pair<int,int>> pq;\n        pq.insert({0, n});\n        while(!pq.empty()) {\n            auto [wgt, node] = *begin(pq);\n            pq.erase(pq.begin());\n            for(auto [i, w] : graph[node]) {       \n                if(dist[i] > wgt + w) {\n                    dist[i] = wgt + w;\n                    pq.insert({dist[i], i});\n                }\n            }\n        }\n    }\n    \n    int countRestrictedPaths(int n, vector<vector<int>>& edges) {\n        vector<vector<pair<int, int>>> graph(n + 1);\n        vector<int> dp(n + 1, -1);\n        vector<int> dist(n + 1, INT_MAX);\n        dist[n] = 0;\n        for (auto &e : edges) {\n            graph[e[0]].push_back({e[1], e[2]});\n            graph[e[1]].push_back({e[0], e[2]});\n        }\n        shortestPath(n, graph, dist);\n        return dfs(n, dp, dist, graph, 0);\n    }\n};\n```
['C']