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