aGrUM  0.14.2
MarkovBlanket.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  ***************************************************************************/
20 
28 #ifndef GUM_MARKOVBLANKET_H
29 #define GUM_MARKOVBLANKET_H
30 
32 #include <agrum/graphs/diGraph.h>
34 
35 namespace gum {
36 
47  class MarkovBlanket {
48  public:
49  MarkovBlanket(const DAGmodel& m, NodeId n);
50  MarkovBlanket(const DAGmodel& m, const std::string& name);
51 
53 
55  DiGraph mb();
56 
57  // @return a dot representation of this MarkovBlanket
58  // node of interest is in red
59  // special arcs (not used during the construction of the Markov Blanket) are in
60  // grey
61  std::string toDot() const;
62 
64  const NodeSet& parents(const NodeId id) const;
65 
67  const NodeSet& children(const NodeId id) const;
68 
70  Size sizeArcs() const;
71 
73  const ArcSet& arcs() const;
74 
76  Size sizeNodes() const;
77 
79  Size size() const;
80 
82  const NodeGraphPart& nodes() const;
83 
86  bool hasSameStructure(const DAGmodel& other);
87 
88  private:
89  void __buildMarkovBlanket();
90 
91  const DAGmodel& __model;
93  const NodeId __node;
95  };
96 } // namespace gum
97 
98 #ifndef GUM_NO_INLINE
100 #endif // GUM_NOINLINE
101 
102 #endif // GUM_MARKOVBLANKET_H
Virtual base class for PGMs using a DAG.
Definition: DAGmodel.h:45
Base classes for oriented graphs.
const NodeSet & parents(const NodeId id) const
wrapping DiGraph::parents(id)
Size sizeArcs() const
wrapping DiGraph::sizeArcs()
Inline implementation of the class building the essential Graph from a DAGmodel.
Size sizeNodes() const
wrapping DiGraph::sizeNodes()
MarkovBlanket(const DAGmodel &m, NodeId n)
const NodeSet & children(const NodeId id) const
wrapping DiGraph::parents(id)
gum is the global namespace for all aGrUM entities
Definition: agrum.h:25
const NodeId __node
Definition: MarkovBlanket.h:93
Class building the markov Blanket from a BN and a nodeName.
Definition: MarkovBlanket.h:47
std::string toDot() const
Size size() const
wrapping DiGraph::size()
bool hasSameStructure(const DAGmodel &other)
const ArcSet & arcs() const
wrapping DiGraph::arcs()
Class representing probabilistic DAG model.
const DAGmodel & __model
Definition: MarkovBlanket.h:91
Base class for all oriented graphs.
Definition: diGraph.h:108
Class for node sets in graph.
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:45
Size NodeId
Type for node ids.
Definition: graphElements.h:97
some utils for topology : NodeId, Edge, Arc and consorts ...
const NodeGraphPart & nodes() const
wrapping DiGraph::nodes()