Graph 2
graph.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <array>
4 #include <iostream>
5 #include <set> // graph_2
6 #include <string>
7 #include <vector>
8 
12 class graph {
13 public:
22  graph(const std::string &file_name);
23 
24  graph(graph const & org) = default;
25  graph& operator=(graph const & rhs) = default;
26 
33  std::vector<std::vector<unsigned int>> get_node2nodes() const;
34 
38  size_t Nedges() const
39  {
40  return _edges.size();
41  }
42 
46  size_t Nvertices() const
47  {
48  return _vertices.size(); // graph_2
49  }
50 
54  size_t Max_vertex() const // graph_2
55  {
56  return _maxvert;
57  }
58 
59  friend std::ostream& operator<<(std::ostream &s, graph const &rhs);
60 
61 private:
66  void DetermineNumberVertices();
67 
68  std::vector<std::array<unsigned int, 2>> _edges;
69  std::set<unsigned int> _vertices;
70 // size_t _nvert; /**< number of vertices */
71  int _maxvert;
73 };
74 
Definition: graph.h:12
graph & operator=(graph const &rhs)=default
size_t Nedges() const
Definition: graph.h:38
size_t Max_vertex() const
Definition: graph.h:54
friend std::ostream & operator<<(std::ostream &s, graph const &rhs)
graph(const std::string &file_name)
Reads edges for graph from file.
size_t Nvertices() const
Definition: graph.h:46
graph(graph const &org)=default
std::vector< std::vector< unsigned int > > get_node2nodes() const
Definition: graph.cpp:42