|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
General attributes for nodes and arc of graphs. More...
#include <aleph-graph.H>
Public Member Functions | |
| void | reset () |
| Reset all attributes to their default value. | |
Public Attributes | |
| Bit_Fields | control_bits |
| long | counter = 0 |
| void * | cookie = nullptr |
General attributes for nodes and arc of graphs.
Each node and arc of a Aleph-w graph manages three fixed attributes:
control_bits: a field of type Bit_Fields for storing little state.counter: a long allowing to represent a much more wider state (colors, visit order, etc)cookie: a cookie is an opaque void pointer. Thes pointer could be used in order to associate to the node or arc state wider or different beyond the possibilities allowed by the bit fields and the counter. The three main uses of this pointer are:cookie and to perform an map. This has the great advantage that the map is deterministically \(O(1)\), by contrast with the probabilistic \(O(1)\) of a hash table or the \(O(\lg
n)\) of a binary search tree. In addition, this alternative, when required, is less space expensive.cookie pointer. Of course, be careful and be sure of deallocating it when it is not longer needed. Also, consider that you will need to cast the cookie to the type of information that you have defined.Definition at line 313 of file aleph-graph.H.
|
inline |
Reset all attributes to their default value.
Definition at line 320 of file aleph-graph.H.
References control_bits, cookie, counter, and Aleph::Bit_Fields::reset().
| Bit_Fields Aleph::Graph_Attr::control_bits |
Definition at line 315 of file aleph-graph.H.
Referenced by reset().
Definition at line 317 of file aleph-graph.H.
Referenced by reset().
| long Aleph::Graph_Attr::counter = 0 |
Definition at line 316 of file aleph-graph.H.
Referenced by reset().