Graph
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 <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 _nvert;
49  }
50 
51  friend std::ostream& operator<<(std::ostream &s, graph const &rhs);
52 
53 private:
58  void DetermineNumberVertices();
59 
60  std::vector<std::array<unsigned int, 2>> _edges;
61  size_t _nvert;
63 };
64 
65 
66 #endif // GRAPH_H_INCLUDED
size_t Nvertices() const
Definition: graph.h:46
std::vector< std::vector< unsigned int > > get_node2nodes() const
Definition: graph.cpp:42
size_t Nedges() const
Definition: graph.h:38
graph & operator=(graph const &rhs)=default
Definition: graph.h:12
friend std::ostream & operator<<(std::ostream &s, graph const &rhs)
graph(const std::string &file_name)
Reads edges for graph from file.