aGrUM  0.20.2
a C++ library for (probabilistic) graphical models
DAGmodel_inl.h
Go to the documentation of this file.
1 /**
2  *
3  * Copyright 2005-2020 Pierre-Henri WUILLEMIN(@LIP6) et Christophe GONZALES(@AMU)
4  * (@AMU) info_at_agrum_dot_org
5  *
6  * This library is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with this library. If not, see <http://www.gnu.org/licenses/>.
18  *
19  */
20 
21 
22 /**
23  * @file
24  * @brief Interface-like class encapsulating basic functionalities for a
25  *DAGModel.
26  *
27  * @author Lionel TORTI and Pierre-Henri WUILLEMIN(@LIP6)
28  */
29 
30 #include <agrum/tools/core/math/math_utils.h>
31 #include <agrum/tools/graphicalModels/DAGmodel.h>
32 
33 namespace gum {
34  INLINE
35  const DAG& DAGmodel::dag() const { return dag_; }
36 
37  INLINE
38  Size DAGmodel::size() const { return dag().size(); }
39 
40  INLINE
41  Size DAGmodel::sizeArcs() const { return dag_.sizeArcs(); }
42 
43  INLINE const ArcSet& DAGmodel::arcs() const { return dag_.arcs(); }
44 
45  INLINE bool DAGmodel::existsArc(const NodeId tail, const NodeId head) const {
46  return dag_.existsArc(tail, head);
47  }
48 
50  const std::string& namehead) const {
52  }
53 
54  INLINE const NodeSet& DAGmodel::parents(const NodeId id) const {
55  return dag_.parents(id);
56  }
57 
58  INLINE const NodeSet& DAGmodel::parents(const std::string& name) const {
59  return parents(idFromName(name));
60  }
61 
63  return dag_.family(id);
64  }
65 
67  return dag_.family(idFromName(name));
68  }
69 
70  INLINE const NodeSet& DAGmodel::children(const NodeId id) const {
71  return dag_.children(id);
72  }
73  INLINE const NodeSet& DAGmodel::children(const std::string& name) const {
74  return dag_.children(idFromName(name));
75  }
76 
78  return dag_.children(ids);
79  }
80 
82  DAGmodel::children(const std::vector< std::string >& names) const {
83  return children(nodeset(names));
84  }
85 
87  return dag_.children(ids);
88  }
89 
91  return parents(nodeset(names));
92  }
93 
94  INLINE bool DAGmodel::exists(NodeId node) const { return dag_.exists(node); }
95 
96  INLINE const NodeGraphPart& DAGmodel::nodes() const {
97  return (NodeGraphPart&)dag_;
98  }
99 
101  return dag().topologicalOrder(clear);
102  }
103 
105  return dag().descendants(id);
106  }
107 
109  return descendants(idFromName(name));
110  }
111 
113  return dag().ancestors(id);
114  }
115 
117  return ancestors(idFromName(name));
118  }
119 
120 
122  const std::vector< std::string >& nodenames) const {
124  }
125 
126 
129  }
130 
132  return dag().dSeparation(X, Y, Z);
133  }
134 
136  const NodeSet& Y,
137  const NodeSet& Z) const {
138  return dag().dSeparation(X, Y, Z);
139  }
140 } /* namespace gum */
INLINE void emplace(Args &&... args)
Definition: set_tpl.h:669