Logo
No results found.
UndirectedGraph
Overview

UndirectedGraph

July 30, 2024
1 min read

用途

重み付き無向グラフを扱う.

使い方

宣言

UndirectedGraph g(n);

重み付き無向パスの追加

g.add(頂点, 頂点, 重み);

実装

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 on

Downloading for offline use...