aGrUM 2.3.2
a C++ library for (probabilistic) graphical models
gum::prm::gspan::EdgeCode Class Reference

represent a DFS code used by gspan. More...

#include <agrum/PRM/gspan/edgeCode.h>

Public Member Functions

 EdgeCode (NodeId i, NodeId j, Size l_i, Size l_ij, Size l_j)
 Default constructor.
 EdgeCode (const EdgeCode &source)
 Copy constructor.
 ~EdgeCode ()
 Destructor.
bool isForward () const
 Returns true if this EdgeCode is a forward edge.
bool isBackward () const
 Returns true if this EdgeCode is a backward edge.
EdgeCodeoperator= (const EdgeCode &source)
 Copy operator.
bool operator== (const EdgeCode &code) const
 Equality operator.
bool operator!= (const EdgeCode &code) const
 Difference operator.
bool operator< (const EdgeCode &code) const
 Lesser than operator.

Public Attributes

NodeId i
 The DFS subscript of the first node in the code.
NodeId j
 The DFS subscript of the second node in the code.
Size l_i
 The label of the first node in the code.
Size l_ij
 The label of the edge in the code.
Size l_j
 The label of the second node in the code.
std::string name
 The string version of this EdgeCode.

Detailed Description

represent a DFS code used by gspan.

A DFS code represents a pair of node and an edge between these two nodes.

Definition at line 72 of file edgeCode.h.

Constructor & Destructor Documentation

◆ EdgeCode() [1/2]

INLINE gum::prm::gspan::EdgeCode::EdgeCode ( NodeId i,
NodeId j,
Size l_i,
Size l_ij,
Size l_j )

Default constructor.

If flag is true then this EdgeCode is a forward edge, otherwise it is a backward edge.

Parameters
iThe DFS subscript of the first node in the code.
jThe DFS subscript of the second node in the code.
l_iThe label of the first node in the code.
l_ijThe label of the edge in the code.
l_jThe label of the second node in the code.

Definition at line 54 of file edgeCode_inl.h.

54 :
55 i(my_i), j(my_j), l_i(my_l_i), l_ij(my_l_ij), l_j(my_l_j) {
56 GUM_CONSTRUCTOR(EdgeCode);
57 std::stringstream sBuff;
58 sBuff << i << j << l_i << l_ij << l_j;
59 name = sBuff.str();
60 }
Size l_i
The label of the first node in the code.
Definition edgeCode.h:103
NodeId i
The DFS subscript of the first node in the code.
Definition edgeCode.h:97
Size l_ij
The label of the edge in the code.
Definition edgeCode.h:106
std::string name
The string version of this EdgeCode.
Definition edgeCode.h:112
EdgeCode(NodeId i, NodeId j, Size l_i, Size l_ij, Size l_j)
Default constructor.
NodeId j
The DFS subscript of the second node in the code.
Definition edgeCode.h:100
Size l_j
The label of the second node in the code.
Definition edgeCode.h:109

References EdgeCode(), i, j, l_i, l_ij, l_j, and name.

Referenced by EdgeCode(), EdgeCode(), ~EdgeCode(), operator!=(), operator<(), operator=(), and operator==().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ EdgeCode() [2/2]

INLINE gum::prm::gspan::EdgeCode::EdgeCode ( const EdgeCode & source)

Copy constructor.

Parameters
sourceThe copied EdgeCode.

Definition at line 63 of file edgeCode_inl.h.

63 :
64 i(source.i), j(source.j), l_i(source.l_i), l_ij(source.l_ij), l_j(source.l_j),
65 name(source.name) {
66 GUM_CONS_CPY(EdgeCode);
67 }

References EdgeCode(), i, j, l_i, l_ij, l_j, and name.

Here is the call graph for this function:

◆ ~EdgeCode()

INLINE gum::prm::gspan::EdgeCode::~EdgeCode ( )

Destructor.

Definition at line 69 of file edgeCode_inl.h.

69 {
70 GUM_DESTRUCTOR(EdgeCode);
71 ;
72 }

References EdgeCode().

Here is the call graph for this function:

Member Function Documentation

◆ isBackward()

INLINE bool gum::prm::gspan::EdgeCode::isBackward ( ) const

Returns true if this EdgeCode is a backward edge.

Returns
Returns true if this EdgeCode is a backward edge.

Definition at line 78 of file edgeCode_inl.h.

78{ return i > j; }

References i, and j.

Referenced by gum::prm::gspan::DFSTree< GUM_SCALAR >::_checkGrowth_(), gum::prm::gspan::DFSCode::operator<(), and gum::prm::gspan::DFSCode::validNeighbors().

Here is the caller graph for this function:

◆ isForward()

INLINE bool gum::prm::gspan::EdgeCode::isForward ( ) const

Returns true if this EdgeCode is a forward edge.

Returns
Returns true if this EdgeCode is a forward edge.

Definition at line 75 of file edgeCode_inl.h.

75{ return i < j; }

References i, and j.

Referenced by gum::prm::gspan::DFSCode::operator<(), gum::prm::gspan::Pattern::pop_back(), and gum::prm::gspan::DFSCode::validNeighbors().

Here is the caller graph for this function:

◆ operator!=()

INLINE bool gum::prm::gspan::EdgeCode::operator!= ( const EdgeCode & code) const

Difference operator.

Parameters
codeThe code tested for difference with this.
Returns
Returns true if this and code are different.

Definition at line 97 of file edgeCode_inl.h.

97 {
98 return ((i != code.i) || (j != code.j) || (l_i != code.l_i) || (l_ij != code.l_ij)
99 || (l_j != code.l_j));
100 }

References EdgeCode(), i, j, l_i, l_ij, and l_j.

Here is the call graph for this function:

◆ operator<()

INLINE bool gum::prm::gspan::EdgeCode::operator< ( const EdgeCode & code) const

Lesser than operator.

Parameters
codeThe code on which the test is made.
Returns
Returns true if this is lesser than code.

Definition at line 103 of file edgeCode_inl.h.

103 {
104 if ((i == code.i) && (j == code.j)) {
105 return (l_i < code.l_i) || ((l_i == code.l_i) && (l_ij < code.l_ij))
106 || ((l_i == code.l_i) && (l_ij == code.l_ij) && (l_j < code.l_j));
107 } else {
108 return ((i == code.i) && (j < code.j)) || ((i < code.j) && (j == code.i));
109 }
110 }

References EdgeCode(), i, j, l_i, l_ij, and l_j.

Here is the call graph for this function:

◆ operator=()

INLINE EdgeCode & gum::prm::gspan::EdgeCode::operator= ( const EdgeCode & source)

Copy operator.

Parameters
sourceThe copied EdgeCode.
Returns
Returns *this after the copy.

Definition at line 81 of file edgeCode_inl.h.

81 {
82 i = source.i;
83 j = source.j;
84 l_i = source.l_i;
85 l_ij = source.l_ij;
86 l_j = source.l_j;
87 return *this;
88 }

References EdgeCode(), i, j, l_i, l_ij, and l_j.

Here is the call graph for this function:

◆ operator==()

INLINE bool gum::prm::gspan::EdgeCode::operator== ( const EdgeCode & code) const

Equality operator.

Parameters
codeThe code tested for equality with this.
Returns
Returns true if this and code are equal.

Definition at line 91 of file edgeCode_inl.h.

91 {
92 return ((i == code.i) && (j == code.j) && (l_i == code.l_i) && (l_ij == code.l_ij)
93 && (l_j == code.l_j));
94 }

References EdgeCode(), i, j, l_i, l_ij, and l_j.

Here is the call graph for this function:

Member Data Documentation

◆ i

◆ j

◆ l_i

Size gum::prm::gspan::EdgeCode::l_i

The label of the first node in the code.

Definition at line 103 of file edgeCode.h.

Referenced by EdgeCode(), EdgeCode(), operator!=(), gum::prm::gspan::DFSCode::operator<(), operator<(), gum::prm::gspan::operator<<(), operator=(), and operator==().

◆ l_ij

Size gum::prm::gspan::EdgeCode::l_ij

The label of the edge in the code.

Definition at line 106 of file edgeCode.h.

Referenced by EdgeCode(), EdgeCode(), operator!=(), gum::prm::gspan::DFSCode::operator<(), operator<(), gum::prm::gspan::operator<<(), operator=(), and operator==().

◆ l_j

Size gum::prm::gspan::EdgeCode::l_j

The label of the second node in the code.

Definition at line 109 of file edgeCode.h.

Referenced by EdgeCode(), EdgeCode(), operator!=(), gum::prm::gspan::DFSCode::operator<(), operator<(), gum::prm::gspan::operator<<(), operator=(), and operator==().

◆ name

std::string gum::prm::gspan::EdgeCode::name

The string version of this EdgeCode.

Definition at line 112 of file edgeCode.h.

Referenced by EdgeCode(), and EdgeCode().


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