aGrUM
0.20.3
a C++ library for (probabilistic) graphical models
edgeCode.h
Go to the documentation of this file.
1
/**
2
*
3
* Copyright (c) 2005-2021 by Pierre-Henri WUILLEMIN(@LIP6) & Christophe GONZALES(@AMU)
4
* 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 Headers of the EdgeCode class.
25
*
26
* @author Lionel TORTI and Pierre-Henri WUILLEMIN(@LIP6)
27
*/
28
#
ifndef
GUM_EDGE_CODE_H
29
#
define
GUM_EDGE_CODE_H
30
31
#
include
<
ostream
>
32
33
#
include
<
agrum
/
agrum
.
h
>
34
#
include
<
agrum
/
tools
/
graphs
/
graphElements
.
h
>
35
36
namespace
gum {
37
38
namespace
prm {
39
40
namespace
gspan {
41
42
/**
43
* @class EdgeCode
44
* @headerfile edgeCode.h <agrum/PRM/gspan/edgeCode.h>
45
* @brief represent a DFS code used by gspan.
46
*
47
* A DFS code represents a pair of node and an edge between these two
48
*nodes.
49
*/
50
51
struct
EdgeCode {
52
/**
53
* Default constructor.
54
*
55
* If flag is true then this EdgeCode is a forward edge,
56
* otherwise it is a backward edge.
57
*
58
* @param i The DFS subscript of the first node in the code.
59
* @param j The DFS subscript of the second node in the code.
60
* @param l_i The label of the first node in the code.
61
* @param l_ij The label of the edge in the code.
62
* @param l_j The label of the second node in the code.
63
*/
64
EdgeCode(NodeId i, NodeId j, Size l_i, Size l_ij, Size l_j);
65
66
/**
67
* Copy constructor.
68
* @param source The copied EdgeCode.
69
*/
70
EdgeCode(
const
EdgeCode& source);
71
72
/// Destructor.
73
~EdgeCode();
74
75
/// The DFS subscript of the first node in the code.
76
NodeId i;
77
78
/// The DFS subscript of the second node in the code.
79
NodeId j;
80
81
/// The label of the first node in the code.
82
Size l_i;
83
84
/// The label of the edge in the code.
85
Size l_ij;
86
87
/// The label of the second node in the code.
88
Size l_j;
89
90
/// The string version of this EdgeCode.
91
std::string name;
92
93
/**
94
* Returns true if this EdgeCode is a forward edge.
95
* @return Returns true if this EdgeCode is a forward edge.
96
*/
97
bool
isForward()
const
;
98
99
/**
100
* Returns true if this EdgeCode is a backward edge.
101
* @return Returns true if this EdgeCode is a backward edge.
102
*/
103
bool
isBackward()
const
;
104
105
/**
106
* Copy operator.
107
* @param source The copied EdgeCode.
108
* @return Returns *this after the copy.
109
*/
110
EdgeCode& operator=(
const
EdgeCode& source);
111
112
/**
113
* Equality operator.
114
* @param code The code tested for equality with this.
115
* @return Returns true if this and code are equal.
116
*/
117
bool
operator==(
const
EdgeCode& code)
const
;
118
119
/**
120
* Difference operator.
121
* @param code The code tested for difference with this.
122
* @return Returns true if this and code are different.
123
*/
124
bool
operator!=(
const
EdgeCode& code)
const
;
125
126
/**
127
* Lesser than operator.
128
* @param code The code on which the test is made.
129
* @return Returns true if this is lesser than code.
130
*/
131
bool
operator<(
const
EdgeCode& code)
const
;
132
};
133
134
/**
135
* Print code in out.
136
* @param out The stream in which code is printed.
137
* @param code The printed EdgeCode.
138
* @return Returns out after printing code in it.
139
*/
140
std::ostream& operator<<(std::ostream& out,
const
EdgeCode& code);
141
142
}
/* namespace gspan */
143
}
/* namespace prm */
144
}
/* namespace gum */
145
146
#
ifndef
GUM_NO_INLINE
147
#
include
<
agrum
/
PRM
/
gspan
/
edgeCode_inl
.
h
>
148
#
endif
// GUM_NO_INLINE
149
150
#
endif
/* GUM_EDGE_CODE_H */