graph_model.h
Go to the documentation of this file.
1 /*
2  * This file is part of the alglib project.
3  *
4  * (c) Divyanshu Kakwani <divkakwani@gmail.com>
5  *
6  * For the full copyright and license information, please view the LICENSE file
7  * that was distributed with this source code.
8  */
9 
10 
11 #pragma once
12 
13 
14 namespace alglib {
15 namespace graph {
16 namespace models {
17 
24 template<typename vertex_t, typename edge_t>
25 class graph_model {
26 
27  public:
29  virtual bool are_adj(const vertex_t&, const vertex_t&) const = 0;
30 
31 
32  virtual void add_vertex(const vertex_t& v) = 0;
33  virtual void add_edge(const vertex_t& u, const vertex_t& v, const edge_t& a) = 0;
34  virtual void add_edge(const edge_t& a) = 0;
35  virtual void remove_vertex(const vertex_t& v) = 0;
36  virtual void remove_edge(const vertex_t& u, const vertex_t& v) = 0;
37 
38  virtual int indeg(const vertex_t& v) const = 0;
39  virtual int outdeg(const vertex_t& v) const = 0;
40 
41  virtual int num_vertices() const = 0;
42  virtual int num_edges() const = 0;
43 
44 /*
45  const_viterator vbegin();
46  const_viterator vend();
47  const_eiterator ebegin();
48  const_eiterator eend();
49  const_viterator avbegin(const vertex_t& v);
50  const_viterator avend(const vertex_t& v);
51  const_eiterator aebegin(const vertex_t& v);
52  const_eiterator aeend(const vertex_t& v);
53 */
54 };
55 
56 } // end of models namespace
57 } // end of graph namespace
58 } // end of alglib namespace
virtual void add_edge(const vertex_t &u, const vertex_t &v, const edge_t &a)=0
virtual int indeg(const vertex_t &v) const =0
virtual bool are_adj(const vertex_t &, const vertex_t &) const =0
Returs true if the two given vertices are adjacent, false otherwise.
Definition: bimap.h:17
virtual int outdeg(const vertex_t &v) const =0
virtual void add_vertex(const vertex_t &v)=0
The interface of a graph model.
Definition: graph_model.h:25
virtual int num_edges() const =0
Definition: edge.h:19
virtual void remove_vertex(const vertex_t &v)=0
virtual int num_vertices() const =0
virtual void remove_edge(const vertex_t &u, const vertex_t &v)=0