aGrUM  0.16.0
edgeCode_inl.h
Go to the documentation of this file.
1 
30 namespace gum {
31  namespace prm {
32  namespace gspan {
33 
34  INLINE
36  NodeId my_i, NodeId my_j, Size my_l_i, Size my_l_ij, Size my_l_j) :
37  i(my_i),
38  j(my_j), l_i(my_l_i), l_ij(my_l_ij), l_j(my_l_j) {
39  GUM_CONSTRUCTOR(EdgeCode);
40  std::stringstream sBuff;
41  sBuff << i << j << l_i << l_ij << l_j;
42  name = sBuff.str();
43  }
44 
45  INLINE
46  EdgeCode::EdgeCode(const EdgeCode& source) :
47  i(source.i), j(source.j), l_i(source.l_i), l_ij(source.l_ij),
48  l_j(source.l_j), name(source.name) {
49  GUM_CONS_CPY(EdgeCode);
50  }
51 
52  INLINE
53  EdgeCode::~EdgeCode() { GUM_DESTRUCTOR(EdgeCode); }
54 
55  INLINE
56  bool EdgeCode::isForward() const { return i < j; }
57 
58  INLINE
59  bool EdgeCode::isBackward() const { return i > j; }
60 
61  INLINE
63  i = source.i;
64  j = source.j;
65  l_i = source.l_i;
66  l_ij = source.l_ij;
67  l_j = source.l_j;
68  return *this;
69  }
70 
71  INLINE
72  bool EdgeCode::operator==(const EdgeCode& code) const {
73  return ((i == code.i) && (j == code.j) && (l_i == code.l_i)
74  && (l_ij == code.l_ij) && (l_j == code.l_j));
75  }
76 
77  INLINE
78  bool EdgeCode::operator!=(const EdgeCode& code) const {
79  return ((i != code.i) || (j != code.j) || (l_i != code.l_i)
80  || (l_ij != code.l_ij) || (l_j != code.l_j));
81  }
82 
83  INLINE
84  bool EdgeCode::operator<(const EdgeCode& code) const {
85  if ((i == code.i) && (j == code.j)) {
86  return (l_i < code.l_i) || ((l_i == code.l_i) && (l_ij < code.l_ij))
87  || ((l_i == code.l_i) && (l_ij == code.l_ij) && (l_j < code.l_j));
88  } else {
89  return ((i == code.i) && (j < code.j))
90  || ((i < code.j) && (j == code.i));
91  }
92  }
93 
94  } // namespace gspan
95  } // namespace prm
96 } // namespace gum
NodeId i
The DFS subscript of the first node in the code.
Definition: edgeCode.h:77
bool operator!=(const EdgeCode &code) const
Difference operator.
Definition: edgeCode_inl.h:78
NodeId j
The DFS subscript of the second node in the code.
Definition: edgeCode.h:80
Size l_ij
The label of the edge in the code.
Definition: edgeCode.h:86
Copyright 2005-2019 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6) {prenom.nom}_at_lip6.fr.
Definition: agrum.h:25
represent a DFS code used by gspan.
Definition: edgeCode.h:52
bool isBackward() const
Returns true if this EdgeCode is a backward edge.
Definition: edgeCode_inl.h:59
bool operator<(const EdgeCode &code) const
Lesser than operator.
Definition: edgeCode_inl.h:84
bool operator==(const EdgeCode &code) const
Equality operator.
Definition: edgeCode_inl.h:72
std::string name
The string version of this EdgeCode.
Definition: edgeCode.h:92
EdgeCode(NodeId i, NodeId j, Size l_i, Size l_ij, Size l_j)
Default constructor.
Definition: edgeCode_inl.h:35
Size l_j
The label of the second node in the code.
Definition: edgeCode.h:89
bool isForward() const
Returns true if this EdgeCode is a forward edge.
Definition: edgeCode_inl.h:56
EdgeCode & operator=(const EdgeCode &source)
Copy operator.
Definition: edgeCode_inl.h:62
std::size_t Size
In aGrUM, hashed values are unsigned long int.
Definition: types.h:48
Size NodeId
Type for node ids.
Definition: graphElements.h:98
Size l_i
The label of the first node in the code.
Definition: edgeCode.h:83