aGrUM 3.1.1
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 57 of file edgeCode_inl.h.

57 :
58 i(my_i), j(my_j), l_i(my_l_i), l_ij(my_l_ij), l_j(my_l_j) {
59 GUM_CONSTRUCTOR(EdgeCode);
60 name = std::format("{}{}{}{}{}", i, j, l_i, l_ij, l_j);
61 }
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 64 of file edgeCode_inl.h.

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

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 70 of file edgeCode_inl.h.

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

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 79 of file edgeCode_inl.h.

79{ 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 76 of file edgeCode_inl.h.

76{ 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 98 of file edgeCode_inl.h.

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

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 104 of file edgeCode_inl.h.

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

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 82 of file edgeCode_inl.h.

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

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 92 of file edgeCode_inl.h.

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

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: