aGrUM  0.14.2
simplicialSet_inl.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 #include <limits>
26 #include <sstream>
27 
28 #ifndef DOXYGEN_SHOULD_SKIP_THIS
29 
30 // to ease IDE parser
31 # include <agrum/core/math/math.h>
33 
34 namespace gum {
35 
36  /* ===========================================================================
37  */
38  /* ===========================================================================
39  */
40  /* === CLASS FOR RETRIEVING SIMPLICIAL, ALMOST AND QUASI SIMPLICIAL NODES ===
41  */
42  /* ===========================================================================
43  */
44  /* ===========================================================================
45  */
46 
48  INLINE
49  bool SimplicialSet::isSimplicial(const NodeId id) {
50  // update the list to which the node belongs if needed
52 
53  // check if the node belongs to the simplicial list
54  return __simplicial_nodes.contains(id);
55  }
56 
57 
59  INLINE
61  if (!hasSimplicialNode()) {
62  GUM_ERROR(NotFound, "No simplicial node could be found");
63  }
64 
65  return __simplicial_nodes.top();
66  }
67 
68 
70  INLINE
72  if (!hasAlmostSimplicialNode()) {
73  GUM_ERROR(NotFound, "no almost simplicial node could be found");
74  }
75 
77  }
78 
79 
81  INLINE
83  if (!hasQuasiSimplicialNode()) {
84  GUM_ERROR(NotFound, "no quasi simplicial node could be found");
85  }
86 
88  }
89 
90 
92  INLINE
94  // check if a node can enter the simplicial list
95  for (auto iter = __changed_status.beginSafe(); // safe iterator needed here
96  iter != __changed_status.endSafe();
97  ++iter) {
98  __updateList(*iter);
99  }
100  }
101 
102 
104  INLINE
107  return __simplicial_nodes;
108  }
109 
110 
112  INLINE
117  }
118 
119 
121  INLINE
125  }
126 
127 
129  INLINE
130  void SimplicialSet::setFillIns(bool b) { __we_want_fill_ins = b; }
131 
132 
134  INLINE
135  const EdgeSet& SimplicialSet::fillIns() const { return __fill_ins_list; }
136 
137 
138 } /* namespace gum */
139 
140 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
Useful macros for maths.
bool contains(const Key &k) const
Indicates whether a given elements belong to the set.
Definition: set_tpl.h:578
NodeId bestQuasiSimplicialNode()
gets a quasi simplicial node with the lowest clique weight
bool hasQuasiSimplicialNode()
indicates whether there exists a quasi simplicial node
bool hasAlmostSimplicialNode()
indicates whether there exists an almost simplicial node
const Val & top() const
returns the element at the top of the priority queue
void __updateAllNodes()
put all the nodes in their appropriate list
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
Set< Edge > EdgeSet
Some typdefs and define for shortcuts ...
void __updateList(const NodeId id)
put node id in the correct simplicial/almost simplicial/quasi simplicial list
NodeSet __changed_status
the set of nodes that have potentially changed of status
const iterator_safe & endSafe() const noexcept
The usual safe end iterator to parse the set.
Definition: set_tpl.h:499
const PriorityQueue< NodeId, double > & allSimplicialNodes()
returns all the simplicial nodes
PriorityQueue< NodeId, double > __simplicial_nodes
a queue of the simplicial nodes ordered by increasing node weight
PriorityQueue< NodeId, double > __quasi_simplicial_nodes
a queue of the quasi simplicial nodes ordered by increasing node weight
bool hasSimplicialNode()
indicates whether there exists a simplicial node
EdgeSet __fill_ins_list
fill-ins list
bool isSimplicial(const NodeId id)
indicates whether a given node is a simplicial node
NodeId bestAlmostSimplicialNode()
gets the almost simplicial node with the lowest clique weight
iterator_safe beginSafe() const
The usual safe begin iterator to parse the set.
Definition: set_tpl.h:485
NodeId bestSimplicialNode()
returns the simplicial node with the lowest clique weight
const PriorityQueue< NodeId, double > & allAlmostSimplicialNodes()
returns all the almost simplicial nodes
PriorityQueue< NodeId, double > __almost_simplicial_nodes
a queue of the almost simplicial nodes ordered by increasing node weight
bool __we_want_fill_ins
a boolean indicating if we want fill-ins list with the standard triangulation method ...
const PriorityQueue< NodeId, double > & allQuasiSimplicialNodes()
returns all the quasi simplicial nodes
void setFillIns(bool on_off)
sets/unset the fill-ins storage in the standard triangulation procedure
An Elimination sequence algorithm that imposes a given partial ordering on the nodes elimination sequ...
Size NodeId
Type for node ids.
Definition: graphElements.h:97
bool contains(const Val &val) const
Indicates whether the priority queue contains a given value.
#define GUM_ERROR(type, msg)
Definition: exceptions.h:52
const EdgeSet & fillIns() const
returns the set of all the fill-ins added to the graph so far