Purpose
Handles weighted undirected graphs.
Usage
Declaration
UndirectedGraph g(n);Add weighted undirected edge
g.add(vertex, vertex, weight);Implementation
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}); }};