UndirectedGraph

romophic-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 on

Licensed under CC BY-NC-ND 4.0
All rights reserved.
Built with Hugo
Theme Stack is designed by Jimmy