C++ Competitive ProgrammingUndirectedGraphromophic-library用途重み付き無向グラフを扱う.使い方宣言1 UndirectedGraph g(n); 重み付き無向パスの追加1 g.add(頂点, 頂点, 重み); 実装 1 2 3 4 5 6 7 8 9 10 11 12 class UndirectedGraph{ public: struct Edge { int u,v,cost; }; const int n; vector<Edge> g; UndirectedGraph(int _n):n(_n){} void add(int u,int v,int cost){ g.push_back({u,v,cost}); } }; Depended onKruskal