#include <vector>#include <map>classGraphNode{public:intval;std::vector<GraphNode*>adj_nei;GraphNode(){val=0;adj_nei=std::vector<GraphNode*>();}GraphNode(int_val){val=_val;adj_nei=std::vector<GraphNode*>();}GraphNode(int_val,std::vector<GraphNode*>_adj_nei){val=_val;adj_nei=_adj_nei;}};classGraphNodeDeepCopy{private:std::map<GraphNode*,GraphNode*>v;public:GraphNode*dcGraph(GraphNode*gn){// Handle null input gracefullyif(gn==nullptr){returnnullptr;}if(v.find(gn)!=v.end()){returnv[gn];}// Create a new node. Note: We don't need to initialize adj_nei here.GraphNode*dcGraphNode=newGraphNode(gn->val);v[gn]=dcGraphNode;// Recursively copy the neighborsfor(GraphNode*nei:gn->adj_nei){dcGraphNode->adj_nei.push_back(dcGraph(nei));}returndcGraphNode;}};
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2024-12-23 UTC。"],[],[]]