Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
Loading...
Searching...
No Matches
Aleph::Bit_Fields Class Reference

Bit fields for nodes and arcs used for marking visit state during processing. More...

#include <aleph-graph.H>

Public Member Functions

 Bit_Fields () noexcept
 All the bits are set to zero.
 
bool get_bit (int bit) const noexcept
 Get a control bit.
 
void set_bit (int bit, int value) noexcept
 Set a control bit.
 
unsigned int get_state () const noexcept
 Return the state value.
 
std::string str_state () const
 Return a stringification version of state.
 
void set_state (unsigned char s) noexcept
 Set the state to the value s
 
void reset (int bit) noexcept
 Reset bit to zero.
 
void reset () noexcept
 Reset all bits and state to zero.
 

Public Attributes

unsigned int depth_first: 1
 
unsigned int breadth_first: 1
 Depth first search.
 
unsigned int test_cycle: 1
 Breadth first search.
 
unsigned int find_path: 1
 Cycle existence test.
 
unsigned int euler: 1
 Path searching (there are several types)
 
unsigned int maximum_flow: 1
 Used during eulerian searching.
 
unsigned int spanning_tree: 1
 Used by the maximum flow algorithms.
 
unsigned int build_subtree: 1
 Used by spannign tree algorithms.
 
unsigned int convert_tree: 1
 Used by subtree or subgraph building.
 
unsigned int cut: 1
 Used for Tree_Node conversion.
 
unsigned int min: 1
 Used for cut points computing.
 
unsigned int state: 2
 Used for min path or min spanning.
 

Detailed Description

Bit fields for nodes and arcs used for marking visit state during processing.

Each node and arc of a graph contains a bitmask intended to mark visit state during the execution of an algorithm. The bits are named according to their use by the library.

If your you intend to use some of these bits for your own processing, then make sure of two things:

  1. Use at the most the eight first bits. Do no use other because they could be removed in future releases.
  2. Make sure that the bit that you use will no be used by an algorithm that you invoke

    Note
    For some reason not yet clearly understood, the bit fields copy by memcpy and other relatives does not work properly on some systems. Possibly this would only happen on little-endian systems. Therefore, do not use these mechanisms.

Definition at line 132 of file aleph-graph.H.

Constructor & Destructor Documentation

◆ Bit_Fields()

Aleph::Bit_Fields::Bit_Fields ( )
inlinenoexcept

All the bits are set to zero.

Definition at line 156 of file aleph-graph.H.

References reset().

Member Function Documentation

◆ get_bit()

bool Aleph::Bit_Fields::get_bit ( int  bit) const
inlinenoexcept

Get a control bit.

It is recommended to use the bit name. By example

NODE_BITS(p).get_bit(Breadth_First)

  @param[in] bit number (or name) of the bit to be read
  @return the logical value of bit
  @throw out_of_range if bit is greater or equal than Num_Bits_Graph.

Definition at line 171 of file aleph-graph.H.

References Aleph::Breadth_First, breadth_first, Aleph::Build_Subtree, build_subtree, Aleph::Convert_Tree, convert_tree, Aleph::Cut, cut, Aleph::Depth_First, depth_first, Aleph::Euler, euler, Aleph::Find_Path, find_path, Aleph::maps(), Aleph::Maximum_Flow, maximum_flow, Aleph::Min, min, Aleph::Spanning_Tree, spanning_tree, Aleph::Test_Cycle, and test_cycle.

◆ get_state()

unsigned int Aleph::Bit_Fields::get_state ( ) const
inlinenoexcept

Return the state value.

Definition at line 223 of file aleph-graph.H.

References state.

◆ reset() [1/2]

void Aleph::Bit_Fields::reset ( )
inlinenoexcept

Reset all bits and state to zero.

Definition at line 249 of file aleph-graph.H.

References breadth_first, build_subtree, convert_tree, cut, depth_first, euler, find_path, maximum_flow, min, spanning_tree, state, and test_cycle.

Referenced by Bit_Fields().

◆ reset() [2/2]

void Aleph::Bit_Fields::reset ( int  bit)
inlinenoexcept

Reset bit to zero.

Definition at line 246 of file aleph-graph.H.

References Aleph::maps(), and set_bit().

Referenced by Aleph::Graph_Attr::reset().

◆ set_bit()

void Aleph::Bit_Fields::set_bit ( int  bit,
int  value 
)
inlinenoexcept

Set a control bit.

Set a specific control bit to zero or one.

The real value of value is not verified. Anything different than zero will be considered as 1.

Parameters
[in]bitto set
[in]valuethe value to set
Exceptions
out_of_rangeif bit is greater or equal than Num_Bits_Graph.

Definition at line 202 of file aleph-graph.H.

References Aleph::Breadth_First, breadth_first, Aleph::Build_Subtree, build_subtree, Aleph::Convert_Tree, convert_tree, Aleph::Cut, cut, Aleph::Depth_First, depth_first, Aleph::Euler, euler, Aleph::Find_Path, find_path, Aleph::maps(), Aleph::Maximum_Flow, maximum_flow, Aleph::Min, min, Aleph::Spanning_Tree, spanning_tree, Aleph::Test_Cycle, and test_cycle.

Referenced by reset().

◆ set_state()

void Aleph::Bit_Fields::set_state ( unsigned char  s)
inlinenoexcept

Set the state to the value s

Definition at line 239 of file aleph-graph.H.

References Aleph::maps(), and state.

◆ str_state()

std::string Aleph::Bit_Fields::str_state ( ) const
inline

Return a stringification version of state.

Definition at line 226 of file aleph-graph.H.

References state.

Member Data Documentation

◆ breadth_first

unsigned int Aleph::Bit_Fields::breadth_first

Depth first search.

Definition at line 137 of file aleph-graph.H.

Referenced by get_bit(), reset(), and set_bit().

◆ build_subtree

unsigned int Aleph::Bit_Fields::build_subtree

Used by spannign tree algorithms.

Definition at line 143 of file aleph-graph.H.

Referenced by get_bit(), reset(), and set_bit().

◆ convert_tree

unsigned int Aleph::Bit_Fields::convert_tree

Used by subtree or subgraph building.

Definition at line 144 of file aleph-graph.H.

Referenced by get_bit(), reset(), and set_bit().

◆ cut

unsigned int Aleph::Bit_Fields::cut

Used for Tree_Node conversion.

Definition at line 145 of file aleph-graph.H.

Referenced by get_bit(), reset(), and set_bit().

◆ depth_first

unsigned int Aleph::Bit_Fields::depth_first

Definition at line 136 of file aleph-graph.H.

Referenced by get_bit(), reset(), and set_bit().

◆ euler

unsigned int Aleph::Bit_Fields::euler

Path searching (there are several types)

Definition at line 140 of file aleph-graph.H.

Referenced by get_bit(), reset(), and set_bit().

◆ find_path

unsigned int Aleph::Bit_Fields::find_path

Cycle existence test.

Definition at line 139 of file aleph-graph.H.

Referenced by get_bit(), reset(), and set_bit().

◆ maximum_flow

unsigned int Aleph::Bit_Fields::maximum_flow

Used during eulerian searching.

Definition at line 141 of file aleph-graph.H.

Referenced by get_bit(), reset(), and set_bit().

◆ min

unsigned int Aleph::Bit_Fields::min

Used for cut points computing.

Definition at line 146 of file aleph-graph.H.

Referenced by get_bit(), reset(), and set_bit().

◆ spanning_tree

unsigned int Aleph::Bit_Fields::spanning_tree

Used by the maximum flow algorithms.

Definition at line 142 of file aleph-graph.H.

Referenced by get_bit(), reset(), and set_bit().

◆ state

unsigned int Aleph::Bit_Fields::state

Used for min path or min spanning.

tree Visit state.

Note that there are two bits. So you can manage 4 different states.

Definition at line 153 of file aleph-graph.H.

Referenced by get_state(), reset(), set_state(), and str_state().

◆ test_cycle

unsigned int Aleph::Bit_Fields::test_cycle

Breadth first search.

Definition at line 138 of file aleph-graph.H.

Referenced by get_bit(), reset(), and set_bit().


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