aGrUM  0.14.2
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 45 of file DAGmodel.h.

Constructor & Destructor Documentation

◆ DAGmodel() [1/2]

gum::DAGmodel::DAGmodel ( )

Default constructor.

Definition at line 28 of file DAGmodel.cpp.

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

◆ ~DAGmodel()

gum::DAGmodel::~DAGmodel ( )
virtual

Destructor.

Definition at line 42 of file DAGmodel.cpp.

References __mutableMoralGraph, and __propertiesMap.

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

◆ DAGmodel() [2/2]

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

Copy constructor.

Do nothing.

Definition at line 32 of file DAGmodel.cpp.

References __propertiesMap.

32  :
33  _dag(from._dag), __mutableMoralGraph(nullptr), __propertiesMap(nullptr) {
34  GUM_CONS_CPY(DAGmodel);
35 
36  if (from.__propertiesMap) {
38  new HashTable< std::string, std::string >(*(from.__propertiesMap));
39  }
40  }
UndiGraph * __mutableMoralGraph
The moral graph of this Directed Graphical Model.
Definition: DAGmodel.h:208
HashTable< std::string, std::string > * __propertiesMap
The properties of this Directed Graphical Model. Initialized using a lazy instantiation.
Definition: DAGmodel.h:212
DAG _dag
The DAG of this Directed Graphical Model.
Definition: DAGmodel.h:200
DAGmodel()
Default constructor.
Definition: DAGmodel.cpp:28

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 51 of file DAGmodel.cpp.

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

Referenced by moralGraph().

51  {
52  // @todo : this is a copy of DAG::moralGraph ... we should do better
54  // transform the arcs into edges
55 
56  for (const auto arc : arcs())
57  __mutableMoralGraph->addEdge(arc.first(), arc.second());
58 
59  //}
60 
61  // marry the parents
62  for (const auto node : nodes()) {
63  const auto& par = parents(node);
64 
65  for (auto it1 = par.begin(); it1 != par.end(); ++it1) {
66  auto it2 = it1;
67 
68  for (++it2; it2 != par.end(); ++it2) {
69  // will automatically check if this edge already exists
70  __mutableMoralGraph->addEdge(*it1, *it2);
71  }
72  }
73  }
74  }
const ArcSet & arcs() const
returns the set of nodes with arc ingoing to a given node
Definition: DAGmodel_inl.h:101
UndiGraph * __mutableMoralGraph
The moral graph of this Directed Graphical Model.
Definition: DAGmodel.h:208
const NodeSet & parents(const NodeId id) const
returns the set of nodes with arc ingoing to a given node
Definition: DAGmodel_inl.h:103
virtual void addEdge(const NodeId first, const NodeId second)
insert a new edge into the undirected graph
Definition: undiGraph_inl.h:32
const NodeGraphPart & nodes() const
Returns a constant reference to the dag of this Bayes Net.
Definition: DAGmodel_inl.h:112
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:60
+ 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 63 of file DAGmodel_inl.h.

References __propertiesMap.

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

63  {
64  if (__propertiesMap == nullptr) {
66  }
67 
68  return *__propertiesMap;
69  }
HashTable< std::string, std::string > * __propertiesMap
The properties of this Directed Graphical Model. Initialized using a lazy instantiation.
Definition: DAGmodel.h:212
+ 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 101 of file DAGmodel_inl.h.

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

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

101 { return _dag.arcs(); }
DAG _dag
The DAG of this Directed Graphical Model.
Definition: DAGmodel.h:200
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 108 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().

108  {
109  return _dag.children(id);
110  }
DAG _dag
The DAG of this Directed Graphical Model.
Definition: DAGmodel.h:200
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 162 of file DAGmodel.h.

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

162  {
163  return parents(idFromName(name));
164  };
const NodeSet & parents(const NodeId id) const
returns the set of nodes with arc ingoing to a given node
Definition: DAGmodel_inl.h:103
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 83 of file DAGmodel_inl.h.

References dag(), and variable().

83  {
84  Instantiation I;
85 
86  for (const auto node : dag())
87  I << variable(node);
88 
89  return I;
90  }
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:60
+ 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 96 of file DAGmodel_inl.h.

References size().

96 { return size() == 0; }
Size size() const
Returns the number of variables in this Directed Graphical Model.
Definition: DAGmodel_inl.h:93
+ 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 119 of file DAGmodel.cpp.

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

Referenced by children().

119  {
120  if (this == &other) return true;
121 
122  if (size() != other.size()) return false;
123 
124  if (sizeArcs() != other.sizeArcs()) return false;
125 
126  for (const auto& nid : nodes()) {
127  try {
128  other.idFromName(variable(nid).name());
129  } catch (NotFound) { return false; }
130  }
131 
132  for (const auto& arc : arcs()) {
133  if (!other.arcs().exists(Arc(other.idFromName(variable(arc.tail()).name()),
134  other.idFromName(variable(arc.head()).name()))))
135  return false;
136  }
137 
138  return true;
139  }
const ArcSet & arcs() const
returns the set of nodes with arc ingoing to a given node
Definition: DAGmodel_inl.h:101
Size sizeArcs() const
Returns the number of arcs in this Directed Graphical Model.
Definition: DAGmodel_inl.h:99
Size size() const
Returns the number of variables in this Directed Graphical Model.
Definition: DAGmodel_inl.h:93
const NodeGraphPart & nodes() const
Returns a constant reference to the dag of this Bayes Net.
Definition: DAGmodel_inl.h:112
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 72 of file DAGmodel_inl.h.

References nodes(), and variable().

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

72  {
73  double dSize = 0.0;
74 
75  for (const auto node : nodes()) {
76  dSize += std::log10(variable(node).domainSize());
77  }
78 
79  return dSize;
80  }
const NodeGraphPart & nodes() const
Returns a constant reference to the dag of this Bayes Net.
Definition: DAGmodel_inl.h:112
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 99 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().

99  {
100  if (clear
101  || (__mutableMoralGraph == nullptr)) { // we have to call _moralGraph
102  if (__mutableMoralGraph == nullptr) {
103  __mutableMoralGraph = new UndiGraph();
104  } else {
105  // clear is True ,__mutableMoralGraph exists
107  }
108 
109  __moralGraph();
110  }
111 
112  return *__mutableMoralGraph;
113  }
virtual void clear()
removes all the nodes and edges from the graph
Definition: undiGraph_inl.h:40
UndiGraph * __mutableMoralGraph
The moral graph of this Directed Graphical Model.
Definition: DAGmodel.h:208
void __moralGraph() const
Returns the moral graph of this DAGModel.
Definition: DAGmodel.cpp:51
+ 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 76 of file DAGmodel.cpp.

References __mutableMoralGraph, __propertiesMap, and _dag.

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

76  {
77  if (this != &source) {
78  if (__propertiesMap) {
79  delete __propertiesMap;
80  __propertiesMap = nullptr;
81  }
82 
83  if (__mutableMoralGraph) {
84  delete __mutableMoralGraph;
85  __mutableMoralGraph = nullptr;
86  }
87 
88  if (source.__propertiesMap != 0) {
90  new HashTable< std::string, std::string >(*(source.__propertiesMap));
91  }
92 
93  _dag = source._dag;
94  }
95 
96  return *this;
97  }
UndiGraph * __mutableMoralGraph
The moral graph of this Directed Graphical Model.
Definition: DAGmodel.h:208
HashTable< std::string, std::string > * __propertiesMap
The properties of this Directed Graphical Model. Initialized using a lazy instantiation.
Definition: DAGmodel.h:212
DAG _dag
The DAG of this Directed Graphical Model.
Definition: DAGmodel.h:200
+ 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 103 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().

103  {
104  return _dag.parents(id);
105  }
DAG _dag
The DAG of this Directed Graphical Model.
Definition: DAGmodel.h:200
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 153 of file DAGmodel.h.

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

153  {
154  return parents(idFromName(name));
155  };
const NodeSet & parents(const NodeId id) const
returns the set of nodes with arc ingoing to a given node
Definition: DAGmodel_inl.h:103
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 34 of file DAGmodel_inl.h.

References __properties(), and GUM_ERROR.

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

34  {
35  try {
36  return __properties()[name];
37  } catch (NotFound&) {
38  std::string msg = "The following property does not exists: ";
39  GUM_ERROR(NotFound, msg + name);
40  }
41  }
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:63
#define GUM_ERROR(type, msg)
Definition: exceptions.h:52
+ 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 45 of file DAGmodel_inl.h.

References __properties().

46  {
47  try {
48  return __properties()[name];
49  } catch (NotFound&) { return byDefault; }
50  }
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:63
+ 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 53 of file DAGmodel_inl.h.

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

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

53  {
54  try {
55  __properties()[name] = value;
56  } catch (NotFound&) { __properties().insert(name, value); }
57  }
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:63
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 93 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().

93 { 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:60
+ 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 99 of file DAGmodel_inl.h.

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

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

99 { return _dag.sizeArcs(); }
DAG _dag
The DAG of this Directed Graphical Model.
Definition: DAGmodel.h:200
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 115 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().

115  {
116  return this->dag().topologicalOrder(clear);
117  }
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:88
const DAG & dag() const
Returns a constant reference to the dag of this Bayes Net.
Definition: DAGmodel_inl.h:60
+ 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 208 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 212 of file DAGmodel.h.

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

◆ _dag


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