aGrUM  0.17.2
a C++ library for (probabilistic) graphical models
gum::DAGmodel Class Referenceabstract

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

#include <agrum/tools/graphicalModels/DAGmodel.h>

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

Public Member Functions

bool hasSameStructure (const DAGmodel &other)
 
double log10DomainSize () const
 
Constructors / Destructors
 DAGmodel ()
 Default constructor. More...
 
virtual ~DAGmodel ()
 Destructor. More...
 
 DAGmodel (const DAGmodel &source)
 Copy constructor. More...
 
Variable manipulation methods.
const DAGdag () const
 Returns a constant reference to the dag of this Bayes Net. More...
 
virtual Size size () const final
 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...
 
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 variable 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...
 
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...
 
Getter and setters
const std::string & property (const std::string &name) const
 Return the value of the property name of this GraphicalModel. More...
 
const std::string & propertyWithDefault (const std::string &name, const std::string &byDefault) const
 Return the value of the property name of this GraphicalModel. More...
 
void setProperty (const std::string &name, const std::string &value)
 Add or change a property of this GraphicalModel. More...
 
Variable manipulation methods.
virtual const VariableNodeMapvariableNodeMap () const =0
 Returns a constant reference to the VariableNodeMap of this Graphical Model. More...
 
virtual bool empty () const
 Retursn true if this Directed Graphical Model is empty. More...
 
Instantiation completeInstantiation () const
 Get an instantiation over all the variables of the model. 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 47 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) {
31  GUM_CONSTRUCTOR(DAGmodel);
32  }
UndiGraph * __mutableMoralGraph
The moral graph of this Directed Graphical Model.
Definition: DAGmodel.h:170
DAGmodel()
Default constructor.
Definition: DAGmodel.cpp:30

◆ ~DAGmodel()

gum::DAGmodel::~DAGmodel ( )
virtual

Destructor.

Definition at line 39 of file DAGmodel.cpp.

References __mutableMoralGraph.

39  {
40  GUM_DESTRUCTOR(DAGmodel);
42  }
UndiGraph * __mutableMoralGraph
The moral graph of this Directed Graphical Model.
Definition: DAGmodel.h:170
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.

34  :
35  _dag(from._dag), __mutableMoralGraph(nullptr) {
36  GUM_CONS_CPY(DAGmodel);
37  }
UndiGraph * __mutableMoralGraph
The moral graph of this Directed Graphical Model.
Definition: DAGmodel.h:170
DAG _dag
The DAG of this Directed Graphical Model.
Definition: DAGmodel.h:162
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 44 of file DAGmodel.cpp.

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

Referenced by moralGraph().

44  {
45  // @todo : this is a copy of DAG::moralGraph ... we should do better
47  // transform the arcs into edges
48 
49  for (const auto arc: arcs())
50  __mutableMoralGraph->addEdge(arc.first(), arc.second());
51 
52  //}
53 
54  // marry the parents
55  for (const auto node: nodes()) {
56  const auto& par = parents(node);
57 
58  for (auto it1 = par.begin(); it1 != par.end(); ++it1) {
59  auto it2 = it1;
60 
61  for (++it2; it2 != par.end(); ++it2) {
62  // will automatically check if this edge already exists
63  __mutableMoralGraph->addEdge(*it1, *it2);
64  }
65  }
66  }
67  }
const ArcSet & arcs() const
returns the set of nodes with arc ingoing to a given node
Definition: DAGmodel_inl.h:44
UndiGraph * __mutableMoralGraph
The moral graph of this Directed Graphical Model.
Definition: DAGmodel.h:170
const NodeSet & parents(const NodeId id) const
returns the set of nodes with arc ingoing to a given node
Definition: DAGmodel_inl.h:46
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:60
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:36
+ Here is the call graph for this function:
+ 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 nodes returned may be empty if no arc within the ArcGraphPart is ingoing into the given node.

Parameters
idthe node toward which the nodes returned share an arc

Definition at line 44 of file DAGmodel_inl.h.

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

Referenced by gum::EssentialGraph::__buildEssentialGraph(), __moralGraph(), gum::MarkovBlanket::hasSameStructure(), hasSameStructure(), and gum::BayesNetFragment< GUM_SCALAR >::toBN().

44 { return _dag.arcs(); }
DAG _dag
The DAG of this Directed Graphical Model.
Definition: DAGmodel.h:162
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 53 of file DAGmodel_inl.h.

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

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

53  {
54  return _dag.children(id);
55  }
DAG _dag
The DAG of this Directed Graphical Model.
Definition: DAGmodel.h:162
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]

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

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

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

Parameters
idthe node toward which the nodes returned share an arc

Definition at line 56 of file DAGmodel_inl.h.

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

56  {
57  return _dag.children(idFromName(name));
58  }
virtual NodeId idFromName(const std::string &name) const =0
Getter by name.
DAG _dag
The DAG of this Directed Graphical Model.
Definition: DAGmodel.h:162
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:

◆ completeInstantiation()

INLINE Instantiation gum::GraphicalModel::completeInstantiation ( ) const
inherited

Get an instantiation over all the variables of the model.

Definition at line 85 of file graphicalModel_inl.h.

References gum::GraphicalModel::nodes(), and gum::GraphicalModel::variable().

85  {
86  Instantiation I;
87 
88  for (const auto node: nodes())
89  I << variable(node);
90 
91  return I;
92  }
virtual const NodeGraphPart & nodes() const =0
Returns a constant reference to the VariableNodeMap of this Graphical Model.
virtual const DiscreteVariable & variable(NodeId id) const =0
Returns a constant reference over a variable given it&#39;s node id.
+ Here is the call graph for this function:

◆ dag()

◆ empty()

INLINE bool gum::GraphicalModel::empty ( ) const
virtualinherited

Retursn true if this Directed Graphical Model is empty.

Definition at line 95 of file graphicalModel_inl.h.

References gum::GraphicalModel::size().

95 { return size() == 0; }
virtual Size size() const =0
Returns the number of variables in this Directed Graphical Model.
+ 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 103 of file DAGmodel.cpp.

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

103  {
104  if (this == &other) return true;
105 
106  if (size() != other.size()) return false;
107 
108  if (sizeArcs() != other.sizeArcs()) return false;
109 
110  for (const auto& nid: nodes()) {
111  try {
112  other.idFromName(variable(nid).name());
113  } catch (NotFound) { return false; }
114  }
115 
116  for (const auto& arc: arcs()) {
117  if (!other.arcs().exists(Arc(other.idFromName(variable(arc.tail()).name()),
118  other.idFromName(variable(arc.head()).name()))))
119  return false;
120  }
121 
122  return true;
123  }
const ArcSet & arcs() const
returns the set of nodes with arc ingoing to a given node
Definition: DAGmodel_inl.h:44
Size sizeArcs() const
Returns the number of arcs in this Directed Graphical Model.
Definition: DAGmodel_inl.h:42
virtual Size size() const final
Returns the number of variables in this Directed Graphical Model.
Definition: DAGmodel_inl.h:39
const NodeGraphPart & nodes() const
Returns a constant reference to the dag of this Bayes Net.
Definition: DAGmodel_inl.h:60
virtual const DiscreteVariable & variable(NodeId id) const =0
Returns a constant reference over a variable given it&#39;s node id.
+ Here is the call 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.

Implements gum::GraphicalModel.

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::GraphicalModel::log10DomainSize ( ) const
inherited

Definition at line 74 of file graphicalModel_inl.h.

References gum::GraphicalModel::nodes(), and gum::GraphicalModel::variable().

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

74  {
75  double dSize = 0.0;
76 
77  for (const auto node: nodes()) {
78  dSize += std::log10(variable(node).domainSize());
79  }
80 
81  return dSize;
82  }
virtual const NodeGraphPart & nodes() const =0
Returns a constant reference to the VariableNodeMap of this Graphical Model.
virtual const DiscreteVariable & variable(NodeId id) const =0
Returns a constant reference over a variable 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 83 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(), and gum::prm::SVE< GUM_SCALAR >::__initLiftedNodes().

83  {
84  if (clear
85  || (__mutableMoralGraph == nullptr)) { // we have to call _moralGraph
86  if (__mutableMoralGraph == nullptr) {
87  __mutableMoralGraph = new UndiGraph();
88  } else {
89  // clear is True ,__mutableMoralGraph exists
91  }
92 
93  __moralGraph();
94  }
95 
96  return *__mutableMoralGraph;
97  }
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:170
void __moralGraph() const
Returns the moral graph of this DAGModel.
Definition: DAGmodel.cpp:44
+ 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
virtual

Returns a constant reference to the dag of this Bayes Net.

Implements gum::GraphicalModel.

Definition at line 60 of file DAGmodel_inl.h.

References _dag.

Referenced by gum::credal::CredalNet< GUM_SCALAR >::__bnCopy(), gum::EssentialGraph::__buildEssentialGraph(), gum::MarkovBlanket::__buildMarkovBlanket(), __moralGraph(), gum::credal::CredalNet< GUM_SCALAR >::__sort_varType(), gum::credal::CNMonteCarloSampling< GUM_SCALAR, BNInferenceEngine >::__verticesSampling(), gum::ImportanceSampling< GUM_SCALAR >::_unsharpenBN(), gum::BayesNetFactory< GUM_SCALAR >::BayesNetFactory(), gum::BayesNetFragment< GUM_SCALAR >::checkConsistency(), gum::learning::DAG2BNLearner< ALLOC >::createBN(), gum::MCBayesNetGenerator< GUM_SCALAR, ICPTGenerator, ICPTDisturber >::disturbBN(), gum::Estimator< GUM_SCALAR >::Estimator(), gum::getMaxModality(), hasSameStructure(), gum::prm::InstanceBayesNet< GUM_SCALAR >::modalities(), gum::prm::ClassBayesNet< GUM_SCALAR >::modalities(), gum::Estimator< GUM_SCALAR >::setFromBN(), gum::BayesNetFragment< GUM_SCALAR >::toBN(), gum::prm::InstanceBayesNet< GUM_SCALAR >::toDot(), gum::prm::ClassBayesNet< GUM_SCALAR >::toDot(), gum::credal::CredalNet< GUM_SCALAR >::toString(), and gum::BayesNetFragment< GUM_SCALAR >::~BayesNetFragment().

60  {
61  return (NodeGraphPart&)_dag;
62  }
DAG _dag
The DAG of this Directed Graphical Model.
Definition: DAGmodel.h:162
+ Here is the caller graph for this function:

◆ operator=()

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

Private copy operator.

Definition at line 69 of file DAGmodel.cpp.

References __mutableMoralGraph, _dag, and gum::GraphicalModel::operator=().

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

69  {
70  if (this != &source) {
72 
73  if (__mutableMoralGraph) {
74  delete __mutableMoralGraph;
75  __mutableMoralGraph = nullptr;
76  }
77  _dag = source._dag;
78  }
79 
80  return *this;
81  }
UndiGraph * __mutableMoralGraph
The moral graph of this Directed Graphical Model.
Definition: DAGmodel.h:170
DAG _dag
The DAG of this Directed Graphical Model.
Definition: DAGmodel.h:162
GraphicalModel & operator=(const GraphicalModel &source)
Private copy operator.
+ Here is the call graph for this function:
+ 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 nodes returned may be empty if no arc within the ArcGraphPart is ingoing into the given node.

Parameters
idthe node toward which the nodes returned share an arc

Definition at line 46 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(), gum::BayesNetFragment< GUM_SCALAR >::installCPT(), parents(), gum::prm::InstanceBayesNet< GUM_SCALAR >::toDot(), and gum::prm::ClassBayesNet< GUM_SCALAR >::toDot().

46  {
47  return _dag.parents(id);
48  }
DAG _dag
The DAG of this Directed Graphical Model.
Definition: DAGmodel.h:162
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]

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

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

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

Parameters
idthe node toward which the nodes returned share an arc

Definition at line 49 of file DAGmodel_inl.h.

References idFromName(), and parents().

49  {
50  return parents(idFromName(name));
51  }
const NodeSet & parents(const NodeId id) const
returns the set of nodes with arc ingoing to a given node
Definition: DAGmodel_inl.h:46
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::GraphicalModel::property ( const std::string &  name) const
inherited

Return the value of the property name of this GraphicalModel.

Exceptions
NotFoundRaised if no name property is found.

Definition at line 37 of file graphicalModel_inl.h.

References gum::GraphicalModel::__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...
#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::GraphicalModel::propertyWithDefault ( const std::string &  name,
const std::string &  byDefault 
) const
inherited

Return the value of the property name of this GraphicalModel.

return byDefault if the property name is not found

Definition at line 57 of file graphicalModel_inl.h.

References gum::GraphicalModel::__properties().

58  {
59  try {
60  return __properties()[name];
61  } catch (NotFound&) { return byDefault; }
62  }
HashTable< std::string, std::string > & __properties() const
Return the properties of this Directed Graphical Model and initialize the hash table is necessary...
+ Here is the call graph for this function:

◆ setProperty()

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

Add or change a property of this GraphicalModel.

Definition at line 65 of file graphicalModel_inl.h.

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

Referenced by gum::BayesNet< double >::fastPrototype(), and gum::IMarkovNet< GUM_SCALAR >::IMarkovNet().

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

◆ size()

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

Returns the number of variables in this Directed Graphical Model.

Implements gum::GraphicalModel.

Definition at line 39 of file DAGmodel_inl.h.

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

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

39 { 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:36
+ 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 42 of file DAGmodel_inl.h.

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

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

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

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

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

99  {
100  return this->dag().topologicalOrder(clear);
101  }
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:36
+ 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 variable given it's node id.

Exceptions
NotFoundIf no variable's id matches varId.

Implements gum::GraphicalModel.

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 gum::MarkovBlanket::hasSameStructure(), hasSameStructure(), 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 170 of file DAGmodel.h.

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

◆ _dag


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