daily pastebin goal
41%
SHARE
TWEET

Graph (undirected, unweighted)

keverman Jan 11th, 2019 14 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class graph
  2. {
  3.     private:
  4.  
  5.         std::vector<std::vector<int>> edges;
  6.  
  7.     public:
  8.  
  9.         graph(int size)
  10.         {
  11.             edges.resize(size);
  12.         }
  13.  
  14.         void add(int from, int to)
  15.         {
  16.             edges[from].push_back(to);
  17.             edges[to].push_back(from);
  18.         }
  19.  
  20.         int size()
  21.         {
  22.             return edges.size();
  23.         }
  24. };
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top