aGrUM  0.20.3
a C++ library for (probabilistic) graphical models
DAGmodel_inl.h
Go to the documentation of this file.
1 /**
2  *
3  * Copyright (c) 2005-2021 by 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 
49  INLINE bool DAGmodel::existsArc(const std::string& nametail, const std::string& namehead) const {
51  }
52 
53  INLINE const NodeSet& DAGmodel::parents(const NodeId id) const { return dag_.parents(id); }
54 
55  INLINE const NodeSet& DAGmodel::parents(const std::string& name) const {
56  return parents(idFromName(name));
57  }
58 
59  INLINE NodeSet DAGmodel::family(const NodeId id) const { return dag_.family(id); }
60 
62  return dag_.family(idFromName(name));
63  }
64 
65  INLINE const NodeSet& DAGmodel::children(const NodeId id) const { return dag_.children(id); }
66  INLINE const NodeSet& DAGmodel::children(const std::string& name) const {
67  return dag_.children(idFromName(name));
68  }
69 
70  INLINE NodeSet DAGmodel::children(const NodeSet& ids) const { return dag_.children(ids); }
71 
73  return children(nodeset(names));
74  }
75 
76  INLINE NodeSet DAGmodel::parents(const NodeSet& ids) const { return dag_.children(ids); }
77 
79  return parents(nodeset(names));
80  }
81 
82  INLINE bool DAGmodel::exists(NodeId node) const { return dag_.exists(node); }
83 
84  INLINE const NodeGraphPart& DAGmodel::nodes() const { return (NodeGraphPart&)dag_; }
85 
87  return dag().topologicalOrder(clear);
88  }
89 
90  INLINE NodeSet DAGmodel::descendants(const NodeId id) const { return dag().descendants(id); }
91 
93  return descendants(idFromName(name));
94  }
95 
96  INLINE NodeSet DAGmodel::ancestors(const NodeId id) const { return dag().ancestors(id); }
97 
99  return ancestors(idFromName(name));
100  }
101 
102 
106  }
107 
108 
111  }
112 
114  return dag().dSeparation(X, Y, Z);
115  }
116 
117  INLINE bool DAGmodel::isIndependent(const NodeSet& X, const NodeSet& Y, const NodeSet& Z) const {
118  return dag().dSeparation(X, Y, Z);
119  }
120 } /* namespace gum */
INLINE void emplace(Args &&... args)
Definition: set_tpl.h:643