aGrUM  0.14.2
DAG.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005 by Christophe GONZALES and Pierre-Henri WUILLEMIN *
3  * {prenom.nom}_at_lip6.fr *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
25 #ifndef GUM_DAG_H
26 #define GUM_DAG_H
27 
28 #include <agrum/graphs/undiGraph.h>
29 #include <agrum/graphs/diGraph.h>
30 
31 namespace gum {
32 
33  /* ====================================================================== */
34  /* === BASE CLASS FOR MANIPULATING GRAPHS WITH BOTH EDGES AND ARCS */
35  /* ====================================================================== */
98  /* ====================================================================== */
99  class DAG : public DiGraph {
100  public:
101  // ############################################################################
103  // ############################################################################
105 
107 
113  explicit DAG(Size nodes_size = HashTableConst::default_size,
114  bool nodes_resize_policy = true,
116  bool arcs_resize_policy = true);
117 
119 
120  DAG(const DAG& g);
121 
123  virtual ~DAG();
124 
126 
127  // ############################################################################
129  // ############################################################################
131 
133 
134  DAG& operator=(const DAG& g);
135 
137 
138  // ############################################################################
140  // ############################################################################
142 
144 
155  virtual void addArc(const NodeId tail, const NodeId head);
157 
158  UndiGraph moralGraph() const;
159 
160  private:
162  bool __hasDirectedPath(const NodeId from, const NodeId to);
163  };
164 
165 } /* namespace gum */
166 
167 #ifndef GUM_NO_INLINE
168 # include <agrum/graphs/DAG_inl.h>
169 #endif // GUM_NOINLINE
170 
171 #endif /* GUM_DAG_H */
Base classes for oriented graphs.
bool __hasDirectedPath(const NodeId from, const NodeId to)
checks whether there exists a directed path from from to to
Definition: DAG.cpp:54
UndiGraph moralGraph() const
Definition: DAG.cpp:86
static constexpr Size default_size
The default number of slots in hashtables.
Definition: hashTable.h:77
Inline implementation of Base classes for directed acylic graphs.
Base classes for undirected graphs.
DAG & operator=(const DAG &g)
copy operator
Definition: DAG_inl.h:33
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
virtual ~DAG()
destructor
Definition: DAG.cpp:47
DAG(Size nodes_size=HashTableConst::default_size, bool nodes_resize_policy=true, Size arcs_size=HashTableConst::default_size, bool arcs_resize_policy=true)
default constructor
Definition: DAG.cpp:35
Base class for all oriented graphs.
Definition: diGraph.h:108
virtual void addArc(const NodeId tail, const NodeId head)
insert a new arc into the directed graph
Definition: DAG_inl.h:40
Base class for undirected graphs.
Definition: undiGraph.h:106
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:45
Base class for dag.
Definition: DAG.h:99
Size NodeId
Type for node ids.
Definition: graphElements.h:97