aGrUM  0.16.0
gum::DAGmodel Class Referenceabstract

Virtual base class for PGMs using a DAG. More...

#include <agrum/graphicalModels/DAGmodel.h>

+ Inheritance diagram for gum::DAGmodel:
+ Collaboration diagram for gum::DAGmodel:

Public Member Functions

double log10DomainSize () const
 
bool hasSameStructure (const DAGmodel &other)
 
Constructors / Destructors
 DAGmodel ()
 Default constructor. More...
 
virtual ~DAGmodel ()
 Destructor. More...
 
 DAGmodel (const DAGmodel &source)
 Copy constructor. More...
 
Getter and setters
const std::string & property (const std::string &name) const
 Return the value of the property name of this DAGModel. More...
 
const std::string & propertyWithDefault (const std::string &name, const std::string &byDefault) const
 Return the value of the property name of this DAGModel. More...
 
void setProperty (const std::string &name, const std::string &value)
 Add or change a property of this DAGModel. More...
 
Variable manipulation methods.
const DAGdag () const
 Returns a constant reference to the dag of this Bayes Net. More...
 
virtual const VariableNodeMapvariableNodeMap () const =0
 Returns a constant reference to the VariableNodeMap of this Directed Graphical Model. More...
 
Size size () const
 Returns the number of variables in this Directed Graphical Model. More...
 
Size sizeArcs () const
 Returns the number of arcs in this Directed Graphical Model. More...
 
bool empty () const
 Retursn true if this Directed Graphical Model is empty. More...
 
const NodeGraphPartnodes () const
 Returns a constant reference to the dag of this Bayes Net. More...
 
virtual const DiscreteVariablevariable (NodeId id) const =0
 Returns a constant reference over a variabe given it's node id. More...
 
virtual NodeId nodeId (const DiscreteVariable &var) const =0
 Return id node src discrete var pointer. More...
 
virtual NodeId idFromName (const std::string &name) const =0
 Getter by name. More...
 
virtual const DiscreteVariablevariableFromName (const std::string &name) const =0
 Getter by name. More...
 
virtual Instantiation completeInstantiation () const final
 Get an instantiation over all the variables of the model. More...
 
Arc manipulation methods.
const ArcSetarcs () const
 returns the set of nodes with arc ingoing to a given node More...
 
const NodeSetparents (const NodeId id) const
 returns the set of nodes with arc ingoing to a given node More...
 
const NodeSetparents (const std::string &name) const
 returns the set of nodes with arc ingoing to a given node More...
 
const NodeSetchildren (const NodeId id) const
 returns the set of nodes with arc outgoing from a given node More...
 
const NodeSetchildren (const std::string &name) const
 returns the set of nodes with arc ingoing to a given node More...
 
Graphical methods
const UndiGraphmoralGraph (bool clear=true) const
 The node's id are coherent with the variables and nodes of the topology. More...
 
const Sequence< NodeId > & topologicalOrder (bool clear=true) const
 The topological order stays the same as long as no variable or arcs are added or erased src the topology. More...
 

Protected Attributes

DAG _dag
 The DAG of this Directed Graphical Model. More...
 

Protected Member Functions

DAGmodeloperator= (const DAGmodel &source)
 Private copy operator. More...
 

Detailed Description

Virtual base class for PGMs using a DAG.

Definition at line 48 of file DAGmodel.h.

Constructor & Destructor Documentation

◆ DAGmodel() [1/2]

gum::DAGmodel::DAGmodel ( )

Default constructor.

Definition at line 30 of file DAGmodel.cpp.

30  : __mutableMoralGraph(nullptr), __propertiesMap(nullptr) {
31  GUM_CONSTRUCTOR(DAGmodel);
32  }
UndiGraph * __mutableMoralGraph
The moral graph of this Directed Graphical Model.
Definition: DAGmodel.h:211
HashTable< std::string, std::string > * __propertiesMap
The properties of this Directed Graphical Model. Initialized using a lazy instantiation.
Definition: DAGmodel.h:215
DAGmodel()
Default constructor.
Definition: DAGmodel.cpp:30

◆ ~DAGmodel()

gum::DAGmodel::~DAGmodel ( )
virtual

Destructor.

Definition at line 44 of file DAGmodel.cpp.

References __mutableMoralGraph, and __propertiesMap.

44  {
45  GUM_DESTRUCTOR(DAGmodel);
46  // Removing previous properties
47 
48  if (__propertiesMap) { delete __propertiesMap; }
49 
51  }
UndiGraph * __mutableMoralGraph
The moral graph of this Directed Graphical Model.
Definition: DAGmodel.h:211
HashTable< std::string, std::string > * __propertiesMap
The properties of this Directed Graphical Model. Initialized using a lazy instantiation.
Definition: DAGmodel.h:215
DAGmodel()
Default constructor.
Definition: DAGmodel.cpp:30

◆ DAGmodel() [2/2]

gum::DAGmodel::DAGmodel ( const DAGmodel source)

Copy constructor.

Do nothing.

Definition at line 34 of file DAGmodel.cpp.

References __propertiesMap.

34  :
35  _dag(from._dag), __mutableMoralGraph(nullptr), __propertiesMap(nullptr) {
36  GUM_CONS_CPY(DAGmodel);
37 
38  if (from.__propertiesMap) {
40  new HashTable< std::string, std::string >(*(from.__propertiesMap));
41  }
42  }
UndiGraph * __mutableMoralGraph
The moral graph of this Directed Graphical Model.
Definition: DAGmodel.h:211
HashTable< std::string, std::string > * __propertiesMap
The properties of this Directed Graphical Model. Initialized using a lazy instantiation.
Definition: DAGmodel.h:215
DAG _dag
The DAG of this Directed Graphical Model.
Definition: DAGmodel.h:203
DAGmodel()
Default constructor.
Definition: DAGmodel.cpp:30

Member Function Documentation

◆ __moralGraph()

void gum::DAGmodel::__moralGraph ( ) const
private

Returns the moral graph of this DAGModel.

Warning
__mutableMoralGraph is assumed to be valid and empty

Definition at line 53 of file DAGmodel.cpp.

References __mutableMoralGraph, gum::UndiGraph::addEdge(), arcs(), dag(), nodes(), parents(), and gum::NodeGraphPart::populateNodes().

Referenced by moralGraph().

53  {
54  // @todo : this is a copy of DAG::moralGraph ... we should do better
56  // transform the arcs into edges
57 
58  for (const auto arc : arcs())
59  __mutableMoralGraph->addEdge(arc.first(), arc.second());
60 
61  //}
62 
63  // marry the parents
64  for (const auto node : nodes()) {
65  const auto& par = parents(node);
66 
67  for (auto it1 = par.begin(); it1 != par.end(); ++it1) {
68  auto it2 = it1;
69 
70  for (++it2; it2 != par.end(); ++it2) {
71  // will automatically check if this edge already exists
72  __mutableMoralGraph->addEdge(*it1, *it2);
73  }
74  }
75  }
76  }
const ArcSet & arcs() const
returns the set of nodes with arc ingoing to a given node
Definition: DAGmodel_inl.h:104
UndiGraph * __mutableMoralGraph
The moral graph of this Directed Graphical Model.
Definition: DAGmodel.h:211
const NodeSet & parents(const NodeId id) const
returns the set of nodes with arc ingoing to a given node
Definition: DAGmodel_inl.h:106
virtual void addEdge(const NodeId first, const NodeId second)
insert a new edge into the undirected graph
Definition: undiGraph_inl.h:35
const NodeGraphPart & nodes() const
Returns a constant reference to the dag of this Bayes Net.
Definition: DAGmodel_inl.h:115
void populateNodes(const NodeGraphPart &s)
populateNodes clears *this and fills it with the same nodes as "s"
const DAG & dag() const
Returns a constant reference to the dag of this Bayes Net.
Definition: DAGmodel_inl.h:63
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __properties()

INLINE HashTable< std::string, std::string > & gum::DAGmodel::__properties ( ) const
private

Return the properties of this Directed Graphical Model and initialize the hash table is necessary.

Definition at line 66 of file DAGmodel_inl.h.

References __propertiesMap.

Referenced by property(), propertyWithDefault(), and setProperty().

66  {
67  if (__propertiesMap == nullptr) {
69  }
70 
71  return *__propertiesMap;
72  }
HashTable< std::string, std::string > * __propertiesMap
The properties of this Directed Graphical Model. Initialized using a lazy instantiation.
Definition: DAGmodel.h:215
+ Here is the caller graph for this function:

◆ arcs()

INLINE const ArcSet & gum::DAGmodel::arcs ( ) const

returns the set of nodes with arc ingoing to a given node

Note that the set of arcs returned may be empty if no arc within the ArcGraphPart is ingoing into the given node.

Parameters
idthe node toward which the arcs returned are pointing

Definition at line 104 of file DAGmodel_inl.h.

References _dag, and gum::ArcGraphPart::arcs().

Referenced by gum::EssentialGraph::__buildEssentialGraph(), __moralGraph(), gum::MarkovBlanket::hasSameStructure(), and hasSameStructure().

104 { return _dag.arcs(); }
DAG _dag
The DAG of this Directed Graphical Model.
Definition: DAGmodel.h:203
const ArcSet & arcs() const
returns the set of arcs stored within the ArcGraphPart
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ children() [1/2]

INLINE const NodeSet & gum::DAGmodel::children ( const NodeId  id) const

returns the set of nodes with arc outgoing from a given node

Note that the set of arcs returned may be empty if no arc within the ArcGraphPart is outgoing from the given node.

Parameters
idthe node which is the tail of the arcs returned

Definition at line 111 of file DAGmodel_inl.h.

References _dag, and gum::ArcGraphPart::children().

Referenced by gum::MarkovBlanket::__buildMarkovBlanket(), parents(), gum::prm::InstanceBayesNet< GUM_SCALAR >::toDot(), and gum::prm::ClassBayesNet< GUM_SCALAR >::toDot().

111  {
112  return _dag.children(id);
113  }
DAG _dag
The DAG of this Directed Graphical Model.
Definition: DAGmodel.h:203
const NodeSet & children(const NodeId id) const
returns the set of nodes with arc outgoing from a given node
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ children() [2/2]

const NodeSet& gum::DAGmodel::children ( const std::string &  name) const
inline

returns the set of nodes with arc ingoing to a given node

Note that the set of arcs returned may be empty if no arc within the ArcGraphPart is ingoing into the given node.

Parameters
idthe node toward which the arcs returned are pointing

Definition at line 165 of file DAGmodel.h.

References hasSameStructure(), idFromName(), log10DomainSize(), moralGraph(), operator=(), parents(), and topologicalOrder().

165  {
166  return parents(idFromName(name));
167  };
const NodeSet & parents(const NodeId id) const
returns the set of nodes with arc ingoing to a given node
Definition: DAGmodel_inl.h:106
virtual NodeId idFromName(const std::string &name) const =0
Getter by name.
+ Here is the call graph for this function:

◆ completeInstantiation()

INLINE Instantiation gum::DAGmodel::completeInstantiation ( ) const
finalvirtual

Get an instantiation over all the variables of the model.

Definition at line 86 of file DAGmodel_inl.h.

References dag(), and variable().

86  {
87  Instantiation I;
88 
89  for (const auto node : dag())
90  I << variable(node);
91 
92  return I;
93  }
virtual const DiscreteVariable & variable(NodeId id) const =0
Returns a constant reference over a variabe given it&#39;s node id.
const DAG & dag() const
Returns a constant reference to the dag of this Bayes Net.
Definition: DAGmodel_inl.h:63
+ Here is the call graph for this function:

◆ dag()

INLINE const DAG & gum::DAGmodel::dag ( ) const

◆ empty()

INLINE bool gum::DAGmodel::empty ( ) const

Retursn true if this Directed Graphical Model is empty.

Definition at line 99 of file DAGmodel_inl.h.

References size().

99 { return size() == 0; }
Size size() const
Returns the number of variables in this Directed Graphical Model.
Definition: DAGmodel_inl.h:96
+ Here is the call graph for this function:

◆ hasSameStructure()

bool gum::DAGmodel::hasSameStructure ( const DAGmodel other)
Returns
true if all the named node are the same and all the named arcs are the same

Definition at line 121 of file DAGmodel.cpp.

References arcs(), gum::Set< Key, Alloc >::exists(), idFromName(), nodes(), size(), sizeArcs(), and variable().

Referenced by children().

121  {
122  if (this == &other) return true;
123 
124  if (size() != other.size()) return false;
125 
126  if (sizeArcs() != other.sizeArcs()) return false;
127 
128  for (const auto& nid : nodes()) {
129  try {
130  other.idFromName(variable(nid).name());
131  } catch (NotFound) { return false; }
132  }
133 
134  for (const auto& arc : arcs()) {
135  if (!other.arcs().exists(Arc(other.idFromName(variable(arc.tail()).name()),
136  other.idFromName(variable(arc.head()).name()))))
137  return false;
138  }
139 
140  return true;
141  }
const ArcSet & arcs() const
returns the set of nodes with arc ingoing to a given node
Definition: DAGmodel_inl.h:104
Size sizeArcs() const
Returns the number of arcs in this Directed Graphical Model.
Definition: DAGmodel_inl.h:102
Size size() const
Returns the number of variables in this Directed Graphical Model.
Definition: DAGmodel_inl.h:96
const NodeGraphPart & nodes() const
Returns a constant reference to the dag of this Bayes Net.
Definition: DAGmodel_inl.h:115
virtual const DiscreteVariable & variable(NodeId id) const =0
Returns a constant reference over a variabe given it&#39;s node id.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ idFromName()

virtual NodeId gum::DAGmodel::idFromName ( const std::string &  name) const
pure virtual

Getter by name.

Exceptions
NotFoundif no such name exists in the graph.

Implemented in gum::BayesNet< GUM_SCALAR >, gum::BayesNet< double >, gum::InfluenceDiagram< GUM_SCALAR >, gum::BayesNetFragment< GUM_SCALAR >, gum::IBayesNet< GUM_SCALAR >, gum::IBayesNet< double >, gum::prm::ClassBayesNet< GUM_SCALAR >, and gum::prm::InstanceBayesNet< GUM_SCALAR >.

Referenced by children(), gum::MarkovBlanket::hasSameStructure(), hasSameStructure(), and parents().

+ Here is the caller graph for this function:

◆ log10DomainSize()

INLINE double gum::DAGmodel::log10DomainSize ( ) const
Returns
Returns the log10 domain size of the joint probabilty for the Directed Graphical Model

Definition at line 75 of file DAGmodel_inl.h.

References nodes(), and variable().

Referenced by children(), and gum::InfluenceDiagram< GUM_SCALAR >::toString().

75  {
76  double dSize = 0.0;
77 
78  for (const auto node : nodes()) {
79  dSize += std::log10(variable(node).domainSize());
80  }
81 
82  return dSize;
83  }
const NodeGraphPart & nodes() const
Returns a constant reference to the dag of this Bayes Net.
Definition: DAGmodel_inl.h:115
virtual const DiscreteVariable & variable(NodeId id) const =0
Returns a constant reference over a variabe given it&#39;s node id.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ moralGraph()

const UndiGraph & gum::DAGmodel::moralGraph ( bool  clear = true) const

The node's id are coherent with the variables and nodes of the topology.

Parameters
clearIf false returns the previously created moral graph.

Definition at line 101 of file DAGmodel.cpp.

References __moralGraph(), __mutableMoralGraph, and gum::UndiGraph::clear().

Referenced by gum::prm::SVED< GUM_SCALAR >::__eliminateNodes(), gum::prm::SVE< GUM_SCALAR >::__eliminateNodes(), gum::prm::SVED< GUM_SCALAR >::__eliminateNodesWithEvidence(), gum::prm::SVE< GUM_SCALAR >::__eliminateNodesWithEvidence(), gum::prm::SVED< GUM_SCALAR >::__initLiftedNodes(), gum::prm::SVE< GUM_SCALAR >::__initLiftedNodes(), and children().

101  {
102  if (clear
103  || (__mutableMoralGraph == nullptr)) { // we have to call _moralGraph
104  if (__mutableMoralGraph == nullptr) {
105  __mutableMoralGraph = new UndiGraph();
106  } else {
107  // clear is True ,__mutableMoralGraph exists
109  }
110 
111  __moralGraph();
112  }
113 
114  return *__mutableMoralGraph;
115  }
virtual void clear()
removes all the nodes and edges from the graph
Definition: undiGraph_inl.h:43
UndiGraph * __mutableMoralGraph
The moral graph of this Directed Graphical Model.
Definition: DAGmodel.h:211
void __moralGraph() const
Returns the moral graph of this DAGModel.
Definition: DAGmodel.cpp:53
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ nodeId()

◆ nodes()

INLINE const NodeGraphPart & gum::DAGmodel::nodes ( ) const

◆ operator=()

DAGmodel & gum::DAGmodel::operator= ( const DAGmodel source)
protected

Private copy operator.

Definition at line 78 of file DAGmodel.cpp.

References __mutableMoralGraph, __propertiesMap, and _dag.

Referenced by children(), and gum::InfluenceDiagram< GUM_SCALAR >::operator=().

78  {
79  if (this != &source) {
80  if (__propertiesMap) {
81  delete __propertiesMap;
82  __propertiesMap = nullptr;
83  }
84 
85  if (__mutableMoralGraph) {
86  delete __mutableMoralGraph;
87  __mutableMoralGraph = nullptr;
88  }
89 
90  if (source.__propertiesMap != 0) {
92  new HashTable< std::string, std::string >(*(source.__propertiesMap));
93  }
94 
95  _dag = source._dag;
96  }
97 
98  return *this;
99  }
UndiGraph * __mutableMoralGraph
The moral graph of this Directed Graphical Model.
Definition: DAGmodel.h:211
HashTable< std::string, std::string > * __propertiesMap
The properties of this Directed Graphical Model. Initialized using a lazy instantiation.
Definition: DAGmodel.h:215
DAG _dag
The DAG of this Directed Graphical Model.
Definition: DAGmodel.h:203
+ Here is the caller graph for this function:

◆ parents() [1/2]

INLINE const NodeSet & gum::DAGmodel::parents ( const NodeId  id) const

returns the set of nodes with arc ingoing to a given node

Note that the set of arcs returned may be empty if no arc within the ArcGraphPart is ingoing into the given node.

Parameters
idthe node toward which the arcs returned are pointing

Definition at line 106 of file DAGmodel_inl.h.

References _dag, and gum::ArcGraphPart::parents().

Referenced by gum::MarkovBlanket::__buildMarkovBlanket(), __moralGraph(), gum::BayesNetFragment< GUM_SCALAR >::_installCPT(), gum::BayesNetFragment< GUM_SCALAR >::checkConsistency(), children(), gum::BayesNetFragment< GUM_SCALAR >::installCPT(), parents(), gum::prm::InstanceBayesNet< GUM_SCALAR >::toDot(), and gum::prm::ClassBayesNet< GUM_SCALAR >::toDot().

106  {
107  return _dag.parents(id);
108  }
DAG _dag
The DAG of this Directed Graphical Model.
Definition: DAGmodel.h:203
const NodeSet & parents(const NodeId id) const
returns the set of nodes with arc ingoing to a given node
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parents() [2/2]

const NodeSet& gum::DAGmodel::parents ( const std::string &  name) const
inline

returns the set of nodes with arc ingoing to a given node

Note that the set of arcs returned may be empty if no arc within the ArcGraphPart is ingoing into the given node.

Parameters
idthe node toward which the arcs returned are pointing

Definition at line 156 of file DAGmodel.h.

References children(), idFromName(), and parents().

156  {
157  return parents(idFromName(name));
158  };
const NodeSet & parents(const NodeId id) const
returns the set of nodes with arc ingoing to a given node
Definition: DAGmodel_inl.h:106
virtual NodeId idFromName(const std::string &name) const =0
Getter by name.
+ Here is the call graph for this function:

◆ property()

INLINE const std::string & gum::DAGmodel::property ( const std::string &  name) const

Return the value of the property name of this DAGModel.

Exceptions
NotFoundRaised if no name property is found.

Definition at line 37 of file DAGmodel_inl.h.

References __properties(), and GUM_ERROR.

Referenced by gum::InfluenceDiagram< GUM_SCALAR >::toDot().

37  {
38  try {
39  return __properties()[name];
40  } catch (NotFound&) {
41  std::string msg = "The following property does not exists: ";
42  GUM_ERROR(NotFound, msg + name);
43  }
44  }
HashTable< std::string, std::string > & __properties() const
Return the properties of this Directed Graphical Model and initialize the hash table is necessary...
Definition: DAGmodel_inl.h:66
#define GUM_ERROR(type, msg)
Definition: exceptions.h:55
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ propertyWithDefault()

INLINE const std::string & gum::DAGmodel::propertyWithDefault ( const std::string &  name,
const std::string &  byDefault 
) const

Return the value of the property name of this DAGModel.

return byDefault if the property name is not found

Definition at line 48 of file DAGmodel_inl.h.

References __properties().

49  {
50  try {
51  return __properties()[name];
52  } catch (NotFound&) { return byDefault; }
53  }
HashTable< std::string, std::string > & __properties() const
Return the properties of this Directed Graphical Model and initialize the hash table is necessary...
Definition: DAGmodel_inl.h:66
+ Here is the call graph for this function:

◆ setProperty()

INLINE void gum::DAGmodel::setProperty ( const std::string &  name,
const std::string &  value 
)

Add or change a property of this DAGModel.

Definition at line 56 of file DAGmodel_inl.h.

References __properties(), and gum::HashTable< Key, Val, Alloc >::insert().

Referenced by gum::BayesNet< double >::fastPrototype().

56  {
57  try {
58  __properties()[name] = value;
59  } catch (NotFound&) { __properties().insert(name, value); }
60  }
HashTable< std::string, std::string > & __properties() const
Return the properties of this Directed Graphical Model and initialize the hash table is necessary...
Definition: DAGmodel_inl.h:66
value_type & insert(const Key &key, const Val &val)
Adds a new element (actually a copy of this element) into the hash table.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ size()

INLINE Size gum::DAGmodel::size ( ) const

Returns the number of variables in this Directed Graphical Model.

Definition at line 96 of file DAGmodel_inl.h.

References dag(), and gum::NodeGraphPart::size().

Referenced by gum::credal::CredalNet< GUM_SCALAR >::__initCNNets(), gum::InfluenceDiagram< GUM_SCALAR >::decisionNodeSize(), empty(), gum::MarkovBlanket::hasSameStructure(), hasSameStructure(), gum::IBayesNet< double >::operator==(), gum::prm::InstanceBayesNet< GUM_SCALAR >::toDot(), and gum::prm::ClassBayesNet< GUM_SCALAR >::toDot().

96 { return dag().size(); }
Size size() const
alias for sizeNodes
const DAG & dag() const
Returns a constant reference to the dag of this Bayes Net.
Definition: DAGmodel_inl.h:63
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sizeArcs()

INLINE Size gum::DAGmodel::sizeArcs ( ) const

Returns the number of arcs in this Directed Graphical Model.

Definition at line 102 of file DAGmodel_inl.h.

References _dag, and gum::ArcGraphPart::sizeArcs().

Referenced by gum::MarkovBlanket::hasSameStructure(), hasSameStructure(), and gum::IBayesNet< double >::operator==().

102 { return _dag.sizeArcs(); }
DAG _dag
The DAG of this Directed Graphical Model.
Definition: DAGmodel.h:203
Size sizeArcs() const
indicates the number of arcs stored within the ArcGraphPart
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ topologicalOrder()

const Sequence< NodeId > & gum::DAGmodel::topologicalOrder ( bool  clear = true) const

The topological order stays the same as long as no variable or arcs are added or erased src the topology.

Parameters
clearIf false returns the previously created topology.

Definition at line 117 of file DAGmodel.cpp.

References dag(), and gum::DiGraph::topologicalOrder().

Referenced by gum::EssentialGraph::__buildEssentialGraph(), gum::InfluenceDiagramGenerator< GUM_SCALAR >::__checkTemporalOrder(), children(), gum::InfluenceDiagram< GUM_SCALAR >::decisionOrderExists(), and gum::InfluenceDiagram< GUM_SCALAR >::getDecisionOrder().

117  {
118  return this->dag().topologicalOrder(clear);
119  }
const Sequence< NodeId > & topologicalOrder(bool clear=true) const
The topological order stays the same as long as no variable or arcs are added or erased src the topol...
Definition: diGraph.cpp:91
const DAG & dag() const
Returns a constant reference to the dag of this Bayes Net.
Definition: DAGmodel_inl.h:63
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ variable()

virtual const DiscreteVariable& gum::DAGmodel::variable ( NodeId  id) const
pure virtual

Returns a constant reference over a variabe given it's node id.

Exceptions
NotFoundIf no variable's id matches varId.

Implemented in gum::BayesNet< GUM_SCALAR >, gum::BayesNet< double >, gum::InfluenceDiagram< GUM_SCALAR >, gum::BayesNetFragment< GUM_SCALAR >, gum::IBayesNet< GUM_SCALAR >, gum::IBayesNet< double >, gum::prm::ClassBayesNet< GUM_SCALAR >, and gum::prm::InstanceBayesNet< GUM_SCALAR >.

Referenced by completeInstantiation(), gum::MarkovBlanket::hasSameStructure(), hasSameStructure(), log10DomainSize(), gum::MarkovBlanket::toDot(), and gum::EssentialGraph::toDot().

+ Here is the caller graph for this function:

◆ variableFromName()

virtual const DiscreteVariable& gum::DAGmodel::variableFromName ( const std::string &  name) const
pure virtual

◆ variableNodeMap()

Member Data Documentation

◆ __mutableMoralGraph

UndiGraph* gum::DAGmodel::__mutableMoralGraph
mutableprivate

The moral graph of this Directed Graphical Model.

Definition at line 211 of file DAGmodel.h.

Referenced by __moralGraph(), moralGraph(), operator=(), and ~DAGmodel().

◆ __propertiesMap

HashTable< std::string, std::string >* gum::DAGmodel::__propertiesMap
mutableprivate

The properties of this Directed Graphical Model. Initialized using a lazy instantiation.

Definition at line 215 of file DAGmodel.h.

Referenced by __properties(), DAGmodel(), operator=(), and ~DAGmodel().

◆ _dag


The documentation for this class was generated from the following files: