aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
MeekRules.h
Go to the documentation of this file.
1/****************************************************************************
2 * This file is part of the aGrUM/pyAgrum library. *
3 * *
4 * Copyright (c) 2005-2025 by *
5 * - Pierre-Henri WUILLEMIN(_at_LIP6) *
6 * - Christophe GONZALES(_at_AMU) *
7 * *
8 * The aGrUM/pyAgrum library is free software; you can redistribute it *
9 * and/or modify it under the terms of either : *
10 * *
11 * - the GNU Lesser General Public License as published by *
12 * the Free Software Foundation, either version 3 of the License, *
13 * or (at your option) any later version, *
14 * - the MIT license (MIT), *
15 * - or both in dual license, as here. *
16 * *
17 * (see https://agrum.gitlab.io/articles/dual-licenses-lgplv3mit.html) *
18 * *
19 * This aGrUM/pyAgrum library is distributed in the hope that it will be *
20 * useful, but WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
21 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES MERCHANTABILITY or FITNESS *
22 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *
23 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *
24 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, *
25 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR *
26 * OTHER DEALINGS IN THE SOFTWARE. *
27 * *
28 * See LICENCES for more details. *
29 * *
30 * SPDX-FileCopyrightText: Copyright 2005-2025 *
31 * - Pierre-Henri WUILLEMIN(_at_LIP6) *
32 * - Christophe GONZALES(_at_AMU) *
33 * SPDX-License-Identifier: LGPL-3.0-or-later OR MIT *
34 * *
35 * Contact : info_at_agrum_dot_org *
36 * homepage : http://agrum.gitlab.io *
37 * gitlab : https://gitlab.com/agrumery/agrum *
38 * *
39 ****************************************************************************/
40
41
47
48#ifndef AGRUM_MEEKRULES_H
49#define AGRUM_MEEKRULES_H
50
51#include <agrum/agrum.h>
52
54
55namespace gum {
56 class MeekRules {
57 public:
58 // ############################################################################
60 // ############################################################################
62
64 MeekRules();
65
67 virtual ~MeekRules();
68
70
72
76
78
82
84
87 DAG propagateToDAG(const MixedGraph& mg);
88
95 std::vector< Arc > choices() const { return _choices_; };
96
97 private:
99
100 std::vector< Arc > _choices_;
101
103
107 bool _applyMeekRules_(MixedGraph& graph, NodeId xj);
108
110
114
121
123
126
127 bool _isOrientable_(const gum::MixedGraph& graph, gum::NodeId xi, gum::NodeId xj) const;
128
129 static bool _existsDirectedPath_(const MixedGraph& graph, NodeId n1, NodeId n2);
130
131 void _complete_(MixedGraph& graph);
132
141 };
142
143} // namespace gum
144
145
146#endif // AGRUM_MEEKRULES_H
Base classes for partially directed acyclic graphs.
The base class for all directed edges.
Base class for dag.
Definition DAG.h:121
MixedGraph _propagates_(const MixedGraph &graph)
PDAG propagateToCPDAG(const MixedGraph &mg)
Propagates the orientation of a MixedGraph (no double-headed arcs) and return a PDAG.
Definition MeekRules.cpp:66
gum::Arc _critereMinParents_(const gum::MixedGraph &graph, gum::NodeId x, gum::NodeId y)
When resolving double-headed arcs, prioritize selecting the option that minimizes the number of paren...
MixedGraph propagate(const MixedGraph &mg)
Propagates the orientation of a MixedGraph (no double-headed arcs) and return a PDAG.
Definition MeekRules.cpp:60
std::vector< Arc > _choices_
Definition MeekRules.h:100
static bool _existsDirectedPath_(const MixedGraph &graph, NodeId n1, NodeId n2)
bool _applyMeekRules_(MixedGraph &graph, NodeId xj)
Propagates the orientation from a node to its neighbours.
virtual ~MeekRules()
destructor
Definition MeekRules.cpp:57
void _complete_(MixedGraph &graph)
bool _isOrientable_(const gum::MixedGraph &graph, gum::NodeId xi, gum::NodeId xj) const
void _propagatesOrientationInChainOfRemainingEdges_(gum::MixedGraph &graph)
heuristic for remaining edges when everything else has been tried
void _orientDoubleHeadedArcs_(MixedGraph &mg)
Tells us if we can orient the edge xi - xj to xi -> xj.
DAG propagateToDAG(const MixedGraph &mg)
Propagates the orientation of a MixedGraph and completes it as a DAG.
Definition MeekRules.cpp:89
std::vector< Arc > choices() const
Get the Choices object : the list of arcs that the algorithm has to choose from a double arc or a dou...
Definition MeekRules.h:95
MeekRules()
default constructor
Definition MeekRules.cpp:54
Base class for mixed graphs.
Definition mixedGraph.h:146
Base class for partially directed acyclic graphs.
Definition PDAG.h:130
Size NodeId
Type for node ids.
gum is the global namespace for all aGrUM entities
Definition agrum.h:46