aGrUM
0.20.2
a C++ library for (probabilistic) graphical models
DAGmodel_inl.h
Go to the documentation of this file.
1
/**
2
*
3
* Copyright 2005-2020 Pierre-Henri WUILLEMIN(@LIP6) et Christophe GONZALES(@AMU)
4
* (@AMU) info_at_agrum_dot_org
5
*
6
* This library is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU Lesser General Public License as published by
8
* the Free Software Foundation, either version 3 of the License, or
9
* (at your option) any later version.
10
*
11
* This library is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU Lesser General Public License for more details.
15
*
16
* You should have received a copy of the GNU Lesser General Public License
17
* along with this library. If not, see <http://www.gnu.org/licenses/>.
18
*
19
*/
20
21
22
/**
23
* @file
24
* @brief Interface-like class encapsulating basic functionalities for a
25
*DAGModel.
26
*
27
* @author Lionel TORTI and Pierre-Henri WUILLEMIN(@LIP6)
28
*/
29
30
#
include
<
agrum
/
tools
/
core
/
math
/
math_utils
.
h
>
31
#
include
<
agrum
/
tools
/
graphicalModels
/
DAGmodel
.
h
>
32
33
namespace
gum
{
34
INLINE
35
const
DAG
&
DAGmodel
::
dag
()
const
{
return
dag_
; }
36
37
INLINE
38
Size
DAGmodel
::
size
()
const
{
return
dag
().
size
(); }
39
40
INLINE
41
Size
DAGmodel
::
sizeArcs
()
const
{
return
dag_
.
sizeArcs
(); }
42
43
INLINE
const
ArcSet
&
DAGmodel
::
arcs
()
const
{
return
dag_
.
arcs
(); }
44
45
INLINE
bool
DAGmodel
::
existsArc
(
const
NodeId
tail
,
const
NodeId
head
)
const
{
46
return
dag_
.
existsArc
(
tail
,
head
);
47
}
48
49
INLINE
bool
DAGmodel
::
existsArc
(
const
std
::
string
&
nametail
,
50
const
std
::
string
&
namehead
)
const
{
51
return
existsArc
(
idFromName
(
nametail
),
idFromName
(
namehead
));
52
}
53
54
INLINE
const
NodeSet
&
DAGmodel
::
parents
(
const
NodeId
id
)
const
{
55
return
dag_
.
parents
(
id
);
56
}
57
58
INLINE
const
NodeSet
&
DAGmodel
::
parents
(
const
std
::
string
&
name
)
const
{
59
return
parents
(
idFromName
(
name
));
60
}
61
62
INLINE
NodeSet
DAGmodel
::
family
(
const
NodeId
id
)
const
{
63
return
dag_
.
family
(
id
);
64
}
65
66
INLINE
NodeSet
DAGmodel
::
family
(
const
std
::
string
&
name
)
const
{
67
return
dag_
.
family
(
idFromName
(
name
));
68
}
69
70
INLINE
const
NodeSet
&
DAGmodel
::
children
(
const
NodeId
id
)
const
{
71
return
dag_
.
children
(
id
);
72
}
73
INLINE
const
NodeSet
&
DAGmodel
::
children
(
const
std
::
string
&
name
)
const
{
74
return
dag_
.
children
(
idFromName
(
name
));
75
}
76
77
INLINE
NodeSet
DAGmodel
::
children
(
const
NodeSet
&
ids
)
const
{
78
return
dag_
.
children
(
ids
);
79
}
80
81
INLINE
NodeSet
82
DAGmodel
::
children
(
const
std
::
vector
<
std
::
string
>&
names
)
const
{
83
return
children
(
nodeset
(
names
));
84
}
85
86
INLINE
NodeSet
DAGmodel
::
parents
(
const
NodeSet
&
ids
)
const
{
87
return
dag_
.
children
(
ids
);
88
}
89
90
INLINE
NodeSet
DAGmodel
::
parents
(
const
std
::
vector
<
std
::
string
>&
names
)
const
{
91
return
parents
(
nodeset
(
names
));
92
}
93
94
INLINE
bool
DAGmodel
::
exists
(
NodeId
node
)
const
{
return
dag_
.
exists
(
node
); }
95
96
INLINE
const
NodeGraphPart
&
DAGmodel
::
nodes
()
const
{
97
return
(
NodeGraphPart
&)
dag_
;
98
}
99
100
INLINE
const
Sequence
<
NodeId
>&
DAGmodel
::
topologicalOrder
(
bool
clear
)
const
{
101
return
dag
().
topologicalOrder
(
clear
);
102
}
103
104
INLINE
NodeSet
DAGmodel
::
descendants
(
const
NodeId
id
)
const
{
105
return
dag
().
descendants
(
id
);
106
}
107
108
INLINE
NodeSet
DAGmodel
::
descendants
(
const
std
::
string
&
name
)
const
{
109
return
descendants
(
idFromName
(
name
));
110
}
111
112
INLINE
NodeSet
DAGmodel
::
ancestors
(
const
NodeId
id
)
const
{
113
return
dag
().
ancestors
(
id
);
114
}
115
116
INLINE
NodeSet
DAGmodel
::
ancestors
(
const
std
::
string
&
name
)
const
{
117
return
ancestors
(
idFromName
(
name
));
118
}
119
120
121
INLINE
UndiGraph
DAGmodel
::
moralizedAncestralGraph
(
122
const
std
::
vector
<
std
::
string
>&
nodenames
)
const
{
123
return
moralizedAncestralGraph
(
nodeset
(
nodenames
));
124
}
125
126
127
INLINE
UndiGraph
DAGmodel
::
moralizedAncestralGraph
(
const
NodeSet
&
nodes
)
const
{
128
return
dag
().
moralizedAncestralGraph
(
nodes
);
129
}
130
131
INLINE
bool
DAGmodel
::
isIndependent
(
NodeId
X
,
NodeId
Y
,
const
NodeSet
&
Z
)
const
{
132
return
dag
().
dSeparation
(
X
,
Y
,
Z
);
133
}
134
135
INLINE
bool
DAGmodel
::
isIndependent
(
const
NodeSet
&
X
,
136
const
NodeSet
&
Y
,
137
const
NodeSet
&
Z
)
const
{
138
return
dag
().
dSeparation
(
X
,
Y
,
Z
);
139
}
140
}
/* namespace gum */
gum::Set::emplace
INLINE void emplace(Args &&... args)
Definition:
set_tpl.h:669